diff --git a/dev/containers-thread/CCBlockingQueue/index.html b/dev/containers-thread/CCBlockingQueue/index.html index 46d7519f..f173cf73 100644 --- a/dev/containers-thread/CCBlockingQueue/index.html +++ b/dev/containers-thread/CCBlockingQueue/index.html @@ -1,2 +1,2 @@ -
CCBlockingQueueThis queue has a limited size. Pushing a value on the queue when it is full will block.
val create : int -> 'a tCreate a new queue of size n. Using n=max_int amounts to using an infinite queue (2^61 items is a lot to fit in memory); using n=1 amounts to using a box with 0 or 1 elements inside.
val push : 'a t -> 'a -> unitpush q x pushes x into q, blocking if the queue is full.
val take : 'a t -> 'aTake the first element, blocking if needed.
val push_list : 'a t -> 'a list -> unitPush items of the list, one by one.
val take_list : 'a t -> int -> 'a listtake_list n q takes n elements out of q.
val try_take : 'a t -> 'a optionTake the first element if the queue is not empty, return None otherwise.
val try_push : 'a t -> 'a -> booltry_push q x pushes x into q if q is not full, in which case it returns true. If it fails because q is full, it returns false.
val peek : 'a t -> 'a optionpeek q returns Some x if x is the first element of q, otherwise it returns None.
val size : _ t -> intNumber of elements currently in the queue.
val capacity : _ t -> intNumber of values the queue can hold.
CCBlockingQueueThis queue has a limited size. Pushing a value on the queue when it is full will block.
val create : int -> 'a tCreate a new queue of size n. Using n=max_int amounts to using an infinite queue (2^61 items is a lot to fit in memory); using n=1 amounts to using a box with 0 or 1 elements inside.
val push : 'a t -> 'a -> unitpush q x pushes x into q, blocking if the queue is full.
val take : 'a t -> 'aTake the first element, blocking if needed.
val push_list : 'a t -> 'a list -> unitPush items of the list, one by one.
val take_list : 'a t -> int -> 'a listtake_list n q takes n elements out of q.
val try_take : 'a t -> 'a optionTake the first element if the queue is not empty, return None otherwise.
val try_push : 'a t -> 'a -> booltry_push q x pushes x into q if q is not full, in which case it returns true. If it fails because q is full, it returns false.
val peek : 'a t -> 'a optionpeek q returns Some x if x is the first element of q, otherwise it returns None.
val size : _ t -> intNumber of elements currently in the queue.
val capacity : _ t -> intNumber of values the queue can hold.
CCLockA value wrapped into a Mutex, for more safety.
val create : 'a -> 'a tCreate a new protected value.
val with_lock : 'a t -> ('a -> 'b) -> 'bwith_lock l f runs f x where x is the value protected with the lock l, in a critical section. If f x fails, with_lock l f fails too but the lock is released.
val try_with_lock : 'a t -> ('a -> 'b) -> 'b optiontry_with_lock l f runs f x in a critical section if l is not locked. x is the value protected by the lock l. If f x fails, try_with_lock l f fails too but the lock is released.
module LockRef : sig ... endType allowing to manipulate the lock as a reference.
with_lock_as_ref l f calls f with a reference-like object that allows to manipulate the value of l safely. The object passed to f must not escape the function call.
val update : 'a t -> ('a -> 'a) -> unitupdate l f replaces the content x of l with f x, atomically.
val update_map : 'a t -> ('a -> 'a * 'b) -> 'bupdate_map l f computes x', y = f (get l), then puts x' in l and returns y.
val get : 'a t -> 'aAtomically get the value in the lock. The value that is returned isn't protected!
val set : 'a t -> 'a -> unitAtomically set the value.
val incr : int t -> unitAtomically increment the value.
val decr : int t -> unitAtomically decrement the value.
val incr_then_get : int t -> intincr_then_get x increments x, and returns its new value.
val get_then_incr : int t -> intget_then_incr x increments x, and returns its previous value.
val decr_then_get : int t -> intdecr_then_get x decrements x, and returns its new value.
val get_then_decr : int t -> intget_then_decr x decrements x, and returns its previous value.
val get_then_set : bool t -> boolget_then_set b sets b to true, and returns the old value.
val get_then_clear : bool t -> boolget_then_clear b sets b to false, and returns the old value.
CCLockA value wrapped into a Mutex, for more safety.
val create : 'a -> 'a tCreate a new protected value.
val with_lock : 'a t -> ('a -> 'b) -> 'bwith_lock l f runs f x where x is the value protected with the lock l, in a critical section. If f x fails, with_lock l f fails too but the lock is released.
val try_with_lock : 'a t -> ('a -> 'b) -> 'b optiontry_with_lock l f runs f x in a critical section if l is not locked. x is the value protected by the lock l. If f x fails, try_with_lock l f fails too but the lock is released.
module LockRef : sig ... endType allowing to manipulate the lock as a reference.
with_lock_as_ref l f calls f with a reference-like object that allows to manipulate the value of l safely. The object passed to f must not escape the function call.
val update : 'a t -> ('a -> 'a) -> unitupdate l f replaces the content x of l with f x, atomically.
val update_map : 'a t -> ('a -> 'a * 'b) -> 'bupdate_map l f computes x', y = f (get l), then puts x' in l and returns y.
val get : 'a t -> 'aAtomically get the value in the lock. The value that is returned isn't protected!
val set : 'a t -> 'a -> unitAtomically set the value.
val incr : int t -> unitAtomically increment the value.
val decr : int t -> unitAtomically decrement the value.
val incr_then_get : int t -> intincr_then_get x increments x, and returns its new value.
val get_then_incr : int t -> intget_then_incr x increments x, and returns its previous value.
val decr_then_get : int t -> intdecr_then_get x decrements x, and returns its new value.
val get_then_decr : int t -> intget_then_decr x decrements x, and returns its previous value.
val get_then_set : bool t -> boolget_then_set b sets b to true, and returns the old value.
val get_then_clear : bool t -> boolget_then_clear b sets b to false, and returns the old value.
CCPoolCCPoolCCSemaphoreval create : int -> tcreate n creates a semaphore with initial value n.
val get : t -> intCurrent value.
val acquire : int -> t -> unitacquire n s blocks until get s >= n, then atomically sets s := !s - n.
val release : int -> t -> unitrelease n s atomically sets s := !s + n.
val with_acquire : n:int -> t -> f:(unit -> 'a) -> 'awith_acquire ~n s ~f first acquires s with n units, calls f (), and then releases s with n units. Safely release the semaphore even if f () fails.
val wait_until_at_least : n:int -> t -> f:(unit -> 'a) -> 'await_until_at_least ~n s ~f waits until get s >= n, then calls f () and returns its result. Doesn't modify the semaphore.
CCSemaphoreval create : int -> tcreate n creates a semaphore with initial value n.
val get : t -> intCurrent value.
val acquire : int -> t -> unitacquire n s blocks until get s >= n, then atomically sets s := !s - n.
val release : int -> t -> unitrelease n s atomically sets s := !s + n.
val with_acquire : n:int -> t -> f:(unit -> 'a) -> 'awith_acquire ~n s ~f first acquires s with n units, calls f (), and then releases s with n units. Safely release the semaphore even if f () fails.
val wait_until_at_least : n:int -> t -> f:(unit -> 'a) -> 'await_until_at_least ~n s ~f waits until get s >= n, then calls f () and returns its result. Doesn't modify the semaphore.
CCThreadstatus: unstable
type t = Thread.tval spawn : (unit -> _) -> tspawn f creates a new thread that runs f ().
val spawn1 : ('a -> _) -> 'a -> tspawn1 f x is like spawn (fun () -> f x).
val spawn2 : ('a -> 'b -> _) -> 'a -> 'b -> tspawn2 f x y is like spawn (fun () -> f x y).
module Arr : sig ... endmodule Barrier : sig ... endCCThreadstatus: unstable
type t = Thread.tval spawn : (unit -> _) -> tspawn f creates a new thread that runs f ().
val spawn1 : ('a -> _) -> 'a -> tspawn1 f x is like spawn (fun () -> f x).
val spawn2 : ('a -> 'b -> _) -> 'a -> 'b -> tspawn2 f x y is like spawn (fun () -> f x y).
module Arr : sig ... endmodule Barrier : sig ... endCCTimerEvent timer
Used to be part of CCFuture.
val create : unit -> tA new timer.
val set_exn_handler : t -> (exn -> unit) -> unitset_exn_handler timer f registers f so that any exception raised by a task scheduled in timer is given to f.
val after : t -> float -> f:(unit -> _) -> unitCall the callback f after the given number of seconds.
val at : t -> float -> f:(unit -> _) -> unitCreate a future that evaluates to () at the given Unix timestamp.
val every : ?delay:float -> t -> float -> f:(unit -> _) -> unitevery timer n ~f calls f () every n seconds. f() can raise ExitEvery to stop the cycle.
val stop : t -> unitStop the given timer, cancelling pending tasks. Idempotent. From now on, calling most other operations on the timer will raise Stopped.
val active : t -> boolReturn true until stop t has been called.
CCTimerEvent timer
Used to be part of CCFuture.
val create : unit -> tA new timer.
val set_exn_handler : t -> (exn -> unit) -> unitset_exn_handler timer f registers f so that any exception raised by a task scheduled in timer is given to f.
val after : t -> float -> f:(unit -> _) -> unitCall the callback f after the given number of seconds.
val at : t -> float -> f:(unit -> _) -> unitCreate a future that evaluates to () at the given Unix timestamp.
val every : ?delay:float -> t -> float -> f:(unit -> _) -> unitevery timer n ~f calls f () every n seconds. f() can raise ExitEvery to stop the cycle.
val stop : t -> unitStop the given timer, cancelling pending tasks. Idempotent. From now on, calling most other operations on the timer will raise Stopped.
val active : t -> boolReturn true until stop t has been called.