Caml1999I0372VE1Stdlib__SemaphoreӠ(Counting@!t!;@@@A@@@@@-semaphore.mlinn@@@@@@A@$make"@#intA@@@@@@@@@qDDqDW@@'A@@'release#@@@@$unitF@@@@@@*x+x @@;B@@'acquire$@#@@@@@@@@@<B ~ ~=B ~ @@MC@@+try_acquire%@5@@@$boolE@@@@@@PG / /QG / J@@aD@@)get_value&@I@@@R@@@@@@bM  cM  !@@sE@@@@flgU M P@wF@@@Ӡ&Binary @!t';@@@A@@@@@vp--wp-3@@@@G@A@$make(@7@@@@@@@@@s[[s[o@@H@@'release)@@@@s@@@@@@zQQzQh@@I@@'acquire*@!@@@@@@@@@'@@J@@+try_acquire+@3@@@q@@@@@@@@K@@@@n@L@@@@o;/1Stdlib__Semaphore0ȝ!Xp㠠&Stdlib0Lku]8_٠8CamlinternalFormatBasics0%FU(Q/Tu@@@Caml1999T037?@C1Stdlib__Semaphore*ocaml.text&_none_@@A Semaphores A semaphore is a thread synchronization device that can be used to control access to a shared resource. Two flavors of semaphores are provided: counting semaphores and binary semaphores. @since 4.12 -semaphore.mliP88X @@@@@@3@@@@@@#intA;@@@A@@@@@:@A@$charB;@@A@@@@@>@A@&stringQ;@@ A@@@@@B@@@%bytesC;@@ A@@@@@F@@@%floatD;@@A@@@@@J@@@$boolE;@@%falsec@@T@$trued@@Z@@@A@@@@@[@A@$unitF;@@"()e@@e@@@A@@@@@f@A@ #exnG;@@@A@@@@@j@@@#effH;@@O@A@A@@@@@@s@@@,continuationI;@@Q@@P@B@A@nY@@@@@@@@@%arrayJ;@@R@A@A@@@@@@@@@ $listK;@@S@A"[]f@@@"::g@@@T@@@ @@A@Y@@@@@@@@&optionL;@@V@A$Noneh@@@$Somei@@@@@A@Y@@@@@@@@)nativeintM;@@A@@@@@@@@%int32N;@@A@@@@@@@@%int64O;@@A@@@@@@@@&lazy_tP;@@X@AJA@Y@@@@@@@@5extension_constructorR;@@A@@@@@@@@*floatarrayS;@@A@@@@@@@@&iarrayT;@@Y@A[A@Y@@@@@@@@*atomic_locU;@@Z@AdA@@@@@@@@@.Assert_failure`#@@@@@J@@@@@@@@[@@A=ocaml.warn_on_literal_pattern @ @0Division_by_zero]#@@@A  @+End_of_file\#$@@@A@'FailureY#,@'@@A!$$@0Invalid_argumentX#5@0@@A*$-#-@-Match_failureV#>@@=@9@;@@a@@A;5>4>@)Not_foundZ#O@@@AC=F<F@-Out_of_memoryW#W@@@AKENDN@.Stack_overflow^#_@@@ASMVLV@.Sys_blocked_io_#g@@@A[U^T^@)Sys_error[#o@j@@Ad^g]g@:Undefined_recursive_modulea#x@@w@s@u@@h@@Auoxnx@:Continuation_already_takenb#@@@A}wv@&Stdlib@Ax9 {2 Counting semaphores} ZZ=@@@@@@  A counting semaphore is a counter that can be accessed concurrently by several threads. The typical use is to synchronize producers and consumers of a resource by counting how many units of the resource are available. The two basic operations on semaphores are: - "release" (also called "V", "post", "up", and "signal"), which increments the value of the counter. This corresponds to producing one more unit of the shared resource and making it available to others. - "acquire" (also called "P", "wait", "down", and "pend"), which waits until the counter is greater than zero and decrements it. This corresponds to consuming one unit of the shared resource. @since 4.12 \??j@@@@@@(CountingAll @F@@БA+!tBnn@@;@@@A@@@@@n@)ocaml.docɐ " The type of counting semaphores. ooB@@@@@@@@@@@@@A@ِ@@@@@@@3@@A#@$makeqDHqDL@б@г#intqDOqDR@@ @@@3@B<@A@@гF!tqDVqDW@@ @@@@@@@@@@@qDD @L [make n] returns a new counting semaphore, with initial value [n]. The initial value [n] must be nonnegative. @raise Invalid_argument if [n < 0] rXXv@@@@@@@)A@@@\$@@@@@@1'release'x(x @б@г!t2x 3x @@ @@@343344444@J_8@A@@г$unitAx Bx @@ @@@@@@@@@@@Lx @ e [release s] increments the value of semaphore [s]. If other threads are waiting on [s], one of them is restarted. If the current value of [s] is equal to [max_int], the value of the semaphore is unchanged and a [Sys_error] exception is raised to signal overflow. @raise Sys_error if the value of the semaphore would overflow [max_int] Yy  Z@ z |@@@@@@@rB@@@m@@@@@@1'acquirepB ~ qB ~ @б@гɠ!t{B ~ |B ~ @@ @@@3}||}}}}}@J_8@A@@г7$unitB ~ B ~ @@ @@@@@@@@@@@B ~ ~ @ސ [acquire s] blocks the calling thread until the value of semaphore [s] is not zero, then atomically decrements the value of [s] and returns. C  E + -@@@@@@@C@@@@@@@@@1+try_acquireG / 3G / >@б@г!tG / AG / B@@ @@@3@J_8@A@@г$boolG / FG / J@@ @@@@@@@@@@@G / / @' [try_acquire s] immediately returns [false] if the value of semaphore [s] is zero. Otherwise, the value of [s] is atomically decremented and [try_acquire s] returns [true]. H K KK  @@@@@@@D@@@7@@@@@@1)get_valueM  M  @б@г[!t M  M  @@ @@@3@J_8@A@@г#intM  M  !@@ @@@@@@@@@@@'M   @p $ [get_value s] returns the current value of semaphore [s]. The current value can be modified at any time by concurrent {!release} and {!acquire} operations. Hence, the [get_value] operation is racy, and its result should only be used for debugging or informational messages. 4N " "5S I K@@@@@@@ME@@@H@@@@@@1@A@mF@&@@q@Q*@@3LKKLLLLL@>S,@AOSlTU M P@@@Vl@T@kj7 {2 Binary semaphores} gW R RhW R n@@@@@@3feefffff@e@A@p@P)@ @@{T@@@$@A  Binary semaphores are a variant of counting semaphores where semaphores can only take two values, 0 and 1. A binary semaphore can be used to control access to a single shared resource, with value 1 meaning "resource is available" and value 0 meaning "resource is unavailable". The "release" operation of a binary semaphore sets its value to 1, and "acquire" waits until the value is 1 and sets it to 0. A binary semaphore can be used instead of a mutex (see module {!Mutex}) when the mutex discipline (of unlocking the mutex from the thread that locked it) is too restrictive. The "acquire" operation corresponds to locking the mutex, and the "release" operation to unlocking it, but "release" can be performed in a thread different than the one that performed the "acquire". Likewise, it is safe to release a binary semaphore that is already available. @since 4.12 Y p pl@@@@@@!&BinaryCnn%@L@@БA+!tDp-2p-3@@;@@A@@@@@p--@𐠠 The type of binary semaphores. q44q4Y@@@@@@@@@G@@@A@ǐ@@@@@@@3@Y@A @$makes[_s[c@б@г$bools[fs[j@@ @@@3@t?9@A@@гC!ts[ns[o@@ @@@@@@@@@@@s[[ @: [make b] returns a new binary semaphore. If [b] is [true], the initial value of the semaphore is 1, meaning "available". If [b] is [false], the initial value of the semaphore is 0, meaning "unavailable". tppxMO@@@@@@@H@@@J@@@@@@1'releasezQUzQ\@б@г}!t zQ_!zQ`@@ @@@3"!!"""""@J_8@A@@гܠ$unit/zQd0zQh@@ @@@@@@@@@@@:zQQ @ [release s] sets the value of semaphore [s] to 1, putting it in the "available" state. If other threads are waiting on [s], one of them is restarted. G{iiH~ @@@@@@@`I@@@[@@@@@@1'acquire^_@б@гƠ!tij@@ @@@3kjjkkkkk@J_8@A@@г%$unitx#y'@@ @@@@@@@@@@@ @̐ [acquire s] blocks the calling thread until the semaphore [s] has value 1 (is available), then atomically sets it to 0 and returns. ((@@@@@@@J@@@@@@@@@1+try_acquire@б@г!t@@ @@@3@J_8@A@@г$bool@@ @@@@@@@@@@@ @ [try_acquire s] immediately returns [false] if the semaphore [s] has value 0. If [s] has value 1, its value is atomically set to 0 and [try_acquire s] returns [true]. @@@@@@@K@@@%퐠@@@@@@1@KEA@$@@o@O(@@3@<Q*@A n(@@@n@@@_@@Y@@q@ @ k@@@3@t@hbA@A@@@lE@@@y@A@ H************************************************************************A@@A@L@ H BMMBM@ H OCaml C C@ H %D&D3@ I Xavier Leroy, Collège de France and INRIA Paris +E44,E4@ H 1F2F@ H Copyright 2020 Institut National de Recherche en Informatique et 7G8G@ H en Automatique. =H>Hh@ H CIiiDIi@ H All rights reserved. This file is distributed under the terms of IJJJ@ H the GNU Lesser General Public License version 2.1, with the OKPKO@ H special exception on linking described in the file LICENSE. ULPPVLP@ H [M\M@ H************************************************************************aNbN6@ * Semaphores A semaphore is a thread synchronization device that can be used to control access to a shared resource. Two flavors of semaphores are provided: counting semaphores and binary semaphores. @since 4.12 g:* {2 Counting semaphores} 䠠 * A counting semaphore is a counter that can be accessed concurrently by several threads. The typical use is to synchronize producers and consumers of a resource by counting how many units of the resource are available. The two basic operations on semaphores are: - "release" (also called "V", "post", "up", and "signal"), which increments the value of the counter. This corresponds to producing one more unit of the shared resource and making it available to others. - "acquire" (also called "P", "wait", "down", and "pend"), which waits until the counter is greater than zero and decrements it. This corresponds to consuming one unit of the shared resource. @since 4.12 ֠ #* The type of counting semaphores.  * [make n] returns a new counting semaphore, with initial value [n]. The initial value [n] must be nonnegative. @raise Invalid_argument if [n < 0] c f* [release s] increments the value of semaphore [s]. If other threads are waiting on [s], one of them is restarted. If the current value of [s] is equal to [max_int], the value of the semaphore is unchanged and a [Sys_error] exception is raised to signal overflow. @raise Sys_error if the value of the semaphore would overflow [max_int]  * [acquire s] blocks the calling thread until the value of semaphore [s] is not zero, then atomically decrements the value of [s] and returns. נ * [try_acquire s] immediately returns [false] if the value of semaphore [s] is zero. Otherwise, the value of [s] is atomically decremented and [try_acquire s] returns [true].  %* [get_value s] returns the current value of semaphore [s]. The current value can be modified at any time by concurrent {!release} and {!acquire} operations. Hence, the [get_value] operation is racy, and its result should only be used for debugging or informational messages. K8* {2 Binary semaphores}  * Binary semaphores are a variant of counting semaphores where semaphores can only take two values, 0 and 1. A binary semaphore can be used to control access to a single shared resource, with value 1 meaning "resource is available" and value 0 meaning "resource is unavailable". The "release" operation of a binary semaphore sets its value to 1, and "acquire" waits until the value is 1 and sets it to 0. A binary semaphore can be used instead of a mutex (see module {!Mutex}) when the mutex discipline (of unlocking the mutex from the thread that locked it) is too restrictive. The "acquire" operation corresponds to locking the mutex, and the "release" operation to unlocking it, but "release" can be performed in a thread different than the one that performed the "acquire". Likewise, it is safe to release a binary semaphore that is already available. @since 4.12  !* The type of binary semaphores. Ԡ * [make b] returns a new binary semaphore. If [b] is [true], the initial value of the semaphore is 1, meaning "available". If [b] is [false], the initial value of the semaphore is 0, meaning "unavailable".  * [release s] sets the value of semaphore [s] to 1, putting it in the "available" state. If other threads are waiting on [s], one of them is restarted. G * [acquire s] blocks the calling thread until the semaphore [s] has value 1 (is available), then atomically sets it to 0 and returns.  * [try_acquire s] immediately returns [false] if the semaphore [s] has value 0. If [s] has value 1, its value is atomically set to 0 and [try_acquire s] returns [true]. @?)../ocamlc0-strict-sequence(-absname"-w5+a-4-9-41-42-44-45-48"-g+-warn-error"+A*-bin-annot)-nostdlib*-principal"-o5stdlib__Semaphore.cmi"-c D/builds/workspace/precheck/flambda/false/label/ocaml-linux-32/stdlib @@0[]ȠZP2{3@@@8CamlinternalFormatBasics0%FU(Q/Tu&Stdlib0Lku]8_٠̐0ȝ!Xp@0ȝ!XpAMC@b@@@@@@@"@@@~ܐ@9s0@+e %@=G0:@@@P@@