diff options
author | Stephane Glondu <steph@glondu.net> | 2021-11-28 17:33:31 +0100 |
---|---|---|
committer | Stephane Glondu <steph@glondu.net> | 2021-11-28 17:33:31 +0100 |
commit | 33ef81cad030530006a5e94b71c5ed32fdda60a2 (patch) | |
tree | f6a74276a8cdab5d8dd2020079ee417625b67724 | |
parent | d17c0b50eced85a5030a91e3c2d319a76ca4ad0d (diff) |
New upstream version 0.9.2
-rw-r--r-- | CHANGES | 4 | ||||
-rw-r--r-- | dune-project | 2 | ||||
-rw-r--r-- | duppy.opam | 2 | ||||
-rw-r--r-- | src/duppy.ml | 10 |
4 files changed, 13 insertions, 5 deletions
@@ -1,3 +1,7 @@ +0.9.2 (07-10-2021) +===== +* Fix deadlock issue at shutdown. + 0.9.1 (06-21-2021) ===== * Make `stop` synchronous, waiting for all tasks to stop diff --git a/dune-project b/dune-project index ab3bc8a..6c50961 100644 --- a/dune-project +++ b/dune-project @@ -1,5 +1,5 @@ (lang dune 2.7) -(version 0.9.1) +(version 0.9.2) (name duppy) (source (github savonet/ocaml-duppy)) (license GPL-2.0) @@ -1,6 +1,6 @@ # This file is generated by dune, edit dune-project instead opam-version: "2.0" -version: "0.9.1" +version: "0.9.2" synopsis: "Library providing monadic threads" maintainer: ["The Savonet Team <savonet-users@lists.sourceforge.net>"] authors: ["Romain Beauxis <toots@rastageeks.org>"] diff --git a/src/duppy.ml b/src/duppy.ml index e0bb6e6..cb0d6e6 100644 --- a/src/duppy.ml +++ b/src/duppy.ml @@ -306,8 +306,14 @@ let queue ?log ?(priorities = fun _ -> true) s name = log (Printf.sprintf "There are %d ready tasks." (List.length s.ready)); if exec s priorities then raise Queue_processed; let wake () = + let is_ready = + Mutex.lock s.ready_m; + let is_ready = s.ready <> [] in + Mutex.unlock s.ready_m; + is_ready + in (* Wake up other queues if there are remaining tasks *) - if s.ready <> [] then begin + if is_ready then begin Mutex.lock s.queues_m; List.iter (fun x -> if x <> c then Condition.signal x) s.queues; Mutex.unlock s.queues_m @@ -319,9 +325,7 @@ let queue ?log ?(priorities = fun _ -> true) s name = Mutex.unlock s.ready_m; process s log; Mutex.unlock s.select_m; - Mutex.lock s.ready_m; wake (); - Mutex.unlock s.ready_m end else begin (* We use s.ready_m mutex here. |