package async_unix

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

When_finished describes how In_thread.run 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.

    *)
val all : t list
val sexp_of_t : t -> Ppx_sexp_conv_lib.Sexp.t
val default : t Core.ref

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.

OCaml

Innovation. Community. Security.