To focus the search input from anywhere on the page, press the 'S' key.
in-package search v0.1.0
This module allows to mix preemptive threads with
Lwt cooperative threads. It maintains an extensible pool of preemptive threads to which you can detach computations.
See Mwt for a more modern implementation.
val detach : ('a -> 'b) -> 'a -> 'b Lwt.t
detach f x runs the computation
f x in a separate preemptive thread.
detach evaluates to an Lwt promise, which is pending until the preemptive thread completes.
simple_init internally, which means that the number of preemptive threads is capped by default at four. If you would like a higher limit, call
Note that Lwt thread-local storage (i.e.,
Lwt.with_value) cannot be safely used from within
f. The same goes for most of the rest of Lwt. If you need to run an Lwt thread in
val run_in_main : (unit -> 'a Lwt.t) -> 'a
run_in_main f can be called from a detached computation to execute
f () in the main preemptive thread, i.e. the one executing
run_in_main f blocks until
f () completes, then returns its result. If
f () raises an exception,
run_in_main f raises the same exception.
Lwt.with_value may be used inside
Lwt.get can correctly retrieve values set this way inside
f (), but not values set using
init min max log initialises this module. i.e. it launches the minimum number of preemptive threads and starts the dispatcher.
simple_init () checks if the library is not yet initialized, and if not, does a simple initialization. The minimum number of threads is set to zero, maximum to four, and the log function is left unchanged, i.e. the default built-in logging function is used. See
Note: this function is automatically called by
get_bounds () returns the minimum and the maximum number of preemptive threads.
set_bounds (min, max) set the minimum and the maximum number of preemptive threads.
Sets the size of the waiting queue, if no more preemptive threads are available. When the queue is full,
detach will sleep until a thread is available.