Commit 23e858d6 authored by Fardale's avatar Fardale
Browse files

master: fix data race on nodes

parent d1bb65ac
......@@ -108,7 +108,7 @@ let rec launch_job server_port pass () =
| None ->
mutex := true;
Logs_lwt.debug (fun m -> m "No free node")
| Some (addr, port, l) ->
| Some (addr, port, _) ->
let sockaddr = Unix.ADDR_INET (Unix.inet_addr_of_string addr, port) in
let computation =
{
......@@ -127,7 +127,12 @@ let rec launch_job server_port pass () =
}
in
if%lwt send_computation sockaddr pass computation then (
( SHashtbl.replace nodes addr (port, computation :: l);
( SHashtbl.update nodes
~f:(fun _ e ->
match e with
| None -> Some (port, [ computation ])
| Some (port, l) -> Some (port, computation :: l))
~k:addr;
if job.current + 1 < job.iteration then
job.current <- job.current + 1
else CCDeque.remove_front jobs;
......
Markdown is supported
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