package async_unix

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

A Helper_thread is a thread that is dedicated to handling computations external to Async. We need them because some libraries (e.g. Sqlite3) require that certain collections of computations run in the same thread.

val create : ?priority:Priority.t -> ?name:string -> unit -> t Async_kernel.Deferred.t

create ?name () creates a new helper thread. The name will be used as the thread name for any work that that is done by the thread that doesn't get its own name.

create uses a thread from Async's thread pool, reserving that thread for exclusive use by the helper thread until the helper thread is no longer used (specifically, finalized and is finished with all its work), at which point the thread is made available for general use by the pool.

create returns a deferred that becomes determined when a helper thread is available. On the other hand, create_now checks if a helper thread is available now, and if so returns it, or else returns Error.

val create_now : ?priority:Priority.t -> ?name:string -> unit -> t Core.Or_error.t