Skip to content

Commit

Permalink
Fix 2 bugs
Browse files Browse the repository at this point in the history
With the flipped bit, the background domain would directely shut down.

Using sleep instead of cpu_relax, leads to a race condition leading
to an abtermal termination (only when running the query from within the
dune tests, though!).
  • Loading branch information
pitag-ha committed Feb 22, 2024
1 parent deda509 commit 97e9570
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/kernel/mpipeline.ml
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ module With_cache = struct
match Atomic.get cache with
| Some { pipeline; file = _ } -> Some pipeline
| None ->
if Atomic.get domain_is_up then None else
if not (Atomic.get domain_is_up) then None else
begin
Domain.cpu_relax ();
loop ()
Expand All @@ -370,10 +370,9 @@ module With_cache = struct
if Atomic.get shut_down then () else
match Atomic.get input with
| None ->
Unix.sleepf 0.05;
Domain.cpu_relax ();
loop ()
| Some { config; source; file } ->
(* Note: This takes a while *)
let new_pipeline = make config source in
Atomic.set cache (Some { pipeline = new_pipeline; file });
Atomic.set input None;
Expand Down

0 comments on commit 97e9570

Please sign in to comment.