package moonpool
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=7194610ba86525f05f9cda15c6f28790ab15804e840bc71269f4590d81d8a390
sha512=625092e840589f2fd46ab88cf72714f4b415d8de0d50e46d4c202149ad7d4e38416a2c5f0100addc23781d6000d3951682b22a915af7f0f69d260d7cf4add9de
doc/moonpool.fib/Moonpool_fib/Main/index.html
Module Moonpool_fib.Main
Source
Main thread.
This is evolved from Moonpool.Immediate_runner
, but unlike it, this API assumes you run it in a thread (possibly the main thread) which will block until the initial computation is done.
This means it's reasonable to use Main.main (fun () -> do_everything)
at the beginning of the program. Other Moonpool pools can be created for background tasks, etc. to do the heavy lifting, and the main thread (inside this immediate runner) can coordinate tasks via Fiber.await
.
Aside from the fact that this blocks the caller thread, it is fairly similar to Background_thread
in that there's a single worker to process tasks/fibers.
This handles effects, including the ones in Fiber
.
main f
runs f()
in a scope that handles effects, including Fiber.await
.
This scope can run background tasks as well, in a cooperative fashion.
Same as main
but with room for optional arguments.