package async_unix
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=814d3a9997ec1316b8b2a601b24471740641647a25002761f7df7869c3ac9e33
doc/async_unix/Async_unix/In_thread/When_finished/index.html
Module In_thread.When_finishedSource
When_finished describes how In_thread.run f behaves when the helper thread finishes f ().
type t = | Notify_the_scheduler(*The helper thread notifies the Async scheduler that the result is ready, so that the scheduler will wake up in a timely manner and run a cycle.
*)| Take_the_async_lock(*The helper thread blocks until it can acquire the Async lock, at which point it runs a cycle.
*)| Try_to_take_the_async_lock(*If the
*)thread_pool_cpu_affinityisInherit, then the helper hread tries to take the Async lock and run a cycle. If thethread_pool_cpu_affinityisCpusetor the helper thread is unable to acquire the Async lock, then it behaves as inNotify_the_scheduler.
include Ppx_enumerate_lib.Enumerable.S with type t := t
default defines the default value used for In_thread.run's ?when_finished argument. Changes to default affect subsequent calls to In_thread.run. Initially, default = Try_to_take_the_async_lock, which typically leads to better latency by avoiding an extra context switch to pass the result to the Async scheduler thread. However, there are applications (e.g. jenga) where Notify_the_scheduler leads to significantly higher throughput by greatly decreasing the total number of Async cycles.