package async_unix

  1. Overview
  2. Docs
Module type
Class type

When_finished describes how f behaves when the helper thread finishes f ().

type t =
  1. | 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.

  2. | Take_the_async_lock

    The helper thread blocks until it can acquire the Async lock, at which point it runs a cycle.

  3. | Try_to_take_the_async_lock

    If the thread_pool_cpu_affinity is Inherit, then the helper hread tries to take the Async lock and run a cycle. If the thread_pool_cpu_affinity is Cpuset or the helper thread is unable to acquire the Async lock, then it behaves as in Notify_the_scheduler.

include Ppx_enumerate_lib.Enumerable.S with type t := t
val all : t list
val sexp_of_t : t -> Sexplib0.Sexp.t
val default : t Core.ref

default defines the default value used for's ?when_finished argument. Changes to default affect subsequent calls to 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.


Innovation. Community. Security.