Skip to content

Commit

Permalink
Make Worker Local Storage actually local
Browse files Browse the repository at this point in the history
Before this fix, the "outter" wls was leaked through argumented_f to
yielding tasks, which would then use the wrong WLS
  • Loading branch information
krtab authored and zapashcanon committed Jun 4, 2024
1 parent ecd9825 commit bdca42d
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/symbolic/symbolic_choice.ml
Original file line number Diff line number Diff line change
Expand Up @@ -224,20 +224,22 @@ module Multicore = struct
let return_status status = Sched (Fun.const status)

let rec bind (mx : ('a, 'wls) t) (f : 'a -> ('b, 'wls) t) : _ t =
let rec bind_status (x : _ status) (f : _ -> _ status) : _ status =
let rec bind_status (x : _ status) (outter_wls : 'wls) f : _ status =
match x with
| Now x -> f x
| Now x -> run (f x) outter_wls
| Yield (prio, lx) ->
Yield (prio, Sched (fun wls -> bind_status (run lx wls) f))
| Choice (mx1, mx2) -> Choice (bind_status mx1 f, bind_status mx2 f)
Yield (prio, Sched (fun wls -> bind_status (run lx wls) wls f))
| Choice (mx1, mx2) ->
let mx1' = bind_status mx1 outter_wls f in
let mx2' = bind_status mx2 outter_wls f in
Choice (mx1', mx2')
| Stop -> Stop
in
Sched
(fun wls ->
let argumented_f x = run (f x) wls in
match run mx wls with
| Yield (prio, mx) -> Yield (prio, bind mx f)
| x -> bind_status x argumented_f )
| x -> bind_status x wls f )

let ( let* ) = bind

Expand Down

0 comments on commit bdca42d

Please sign in to comment.