MyLifeLabs / nproc

Process pools for OCaml
Other
29 stars 6 forks source link

Fix concurrent access to the task stream #4

Closed pveber closed 11 years ago

pveber commented 11 years ago

This is a fix for issue #3, which is not so benign after all, since even if the result is correct, it wastes a potentially substantial amount of ressources. It seems that others noted that the access to an [Lwt_stream] should sometimes be protected by a mutex : https://github.com/avsm/mirage/blob/master/lib/std/lwt_stream.ml#L35

I am not claiming the fix is the best possible, and I have very little experience with concurrent programming/lwt. I'd be happy to discuss the patch further if you see some potential pitfalls.