MultiWorkerLwt
commit10087cc1e2dd449cfeb0617ed57a801ce4d2c04c
authorGabe Levi <gabe@fb.com>
Wed, 28 Feb 2018 19:37:44 +0000 (28 11:37 -0800)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Wed, 28 Feb 2018 20:07:09 +0000 (28 12:07 -0800)
treeaedb389158af5beef433610009a1433bc4425e8c
parent558eefcb656d76793b810d0327cbedb866b40984
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
23 files changed:
hphp/hack/src/decl/decl_redecl_service.mli
hphp/hack/src/decl/decl_service.ml
hphp/hack/src/decl/decl_service.mli
hphp/hack/src/gen_deps/dependency_service.mli
hphp/hack/src/parser/parsing_service.mli
hphp/hack/src/procs/multiThreadedCall.ml [copied from hphp/hack/src/procs/multiWorker.ml with 62% similarity]
hphp/hack/src/procs/multiThreadedCall.mli [new file with mode: 0644]
hphp/hack/src/procs/multiWorker.ml
hphp/hack/src/procs/multiWorker.mli
hphp/hack/src/procs/multiWorkerLwt.ml [new file with mode: 0644]
hphp/hack/src/procs/multiWorkerLwt.mli [new file with mode: 0644]
hphp/hack/src/procs/workerController.ml
hphp/hack/src/procs/workerController.mli
hphp/hack/src/procs/workerControllerLwt.ml [new file with mode: 0644]
hphp/hack/src/procs/workerControllerLwt.mli [copied from hphp/hack/src/server/serverWorker.mli with 67% similarity]
hphp/hack/src/server/serverEnv.ml
hphp/hack/src/server/serverInferTypeBatch.ml
hphp/hack/src/server/serverInit.ml
hphp/hack/src/server/serverWorker.ml
hphp/hack/src/server/serverWorker.mli
hphp/hack/src/utils/marshal_tools_lwt.ml
hphp/hack/src/utils/marshal_tools_lwt.mli
hphp/hack/test/procs/procs_test_utils.ml