Fix data race in ProcessPool

Summary:
This diff fixes a data race in ProcessPool: out channel flush was
outside of the critical section.

Reviewed By: ezgicicek

Differential Revision: D17853991

fbshipit-source-id: ac0fd2a69
master
Sungkeun Cho 5 years ago committed by Facebook Github Bot
parent d3bad1ce44
commit 855cc26b25

@ -85,8 +85,9 @@ let marshal_to_pipe ?file_lock fd x =
PerfEvent.log_begin_event logger ~categories:["sys"] ~name:"send to pipe" () ) ;
Option.iter file_lock ~f:(fun {Utils.lock} -> lock ()) ;
Marshal.to_channel fd x [] ;
Option.iter file_lock ~f:(fun {Utils.unlock} -> unlock ()) ;
(* Channel flush should be inside the critical section. *)
Out_channel.flush fd ;
Option.iter file_lock ~f:(fun {Utils.unlock} -> unlock ()) ;
PerfEvent.(log (fun logger -> log_end_event logger ()))

Loading…
Cancel
Save