Commit b4328d44 authored by Julien Tesson's avatar Julien Tesson
Browse files

bugfix : sync() was locked because main redeclare a different global counter

parent 59cdc74a
......@@ -76,6 +76,9 @@ Bsmlsig.BSML
(** *** Syncronisation tools *)
(* ********************************* *)
(** Global counter incremented by workers to let the main thread know that they have reached the next sync point.
When all worker are ready, the last thread reset it to zero.
*)
let global_counter = Atomic.make 0
......@@ -206,10 +209,6 @@ Bsmlsig.BSML
);
notify_all ()
(** Global counter incremented by workers to let the main thread know that they have reached the next sync point.
When all worker are ready, the main thread reset it to zero.
*)
let global_counter = Atomic.make 0
(** Legacy code, should not be used - Synchronisation with all active threads *)
let join_all () = Array.iter (fun th -> Domain.join th) !threads
......@@ -236,7 +235,7 @@ Bsmlsig.BSML
let sync () =
(* adding Sync to the action list *)
add Sync;
(* notifying all threads they have awainting work *)
(* notifying all threads they have awaiting work *)
notify_all();
(* waiting until all threads said they finshed *)
commit_one_and_wait global_counter notify_all_with_main_but
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment