MultiWorkerLwt
Summary:
I want to use Lwt in the Flow server. Lwt is a co-operative threading library. A thread will never be preempted. Instead, it must yield. This generally happens when it does I/O.
The big blocking I/O that the Flow server performs is sending data to and reading data from the workers. So if the Flow server uses MultiWorkerLwt instead of MultiWorker, the thread will yield whenever it is waiting for workers to finish.
I built this to avoid compiling Lwt into Hack. So none of the Lwt modules are compiled into Hack. That is why this may look a little convoluted, using functors and whatnot.
I also abstracted the `WorkerController.worker` type into `MultiWorker.worker` and `MultiWorkerLwt.worker`. This prevents anyone from accidentally using a worker sometimes with `MultiWorker` and sometimes with `MultiWorkerLwt`. This generally is harmless, but it's cleaner to always use one or always use the other.
Reviewed By: avikchaudhuri
Differential Revision:
D6846317
fbshipit-source-id:
06a97dccf94724124005b4b898a5bf3d328b78e0