···3838 by another thread will suspend until the other thread unlocks
3939 the mutex.
40404141- @raise Sys_error if the mutex is already locked by the thread
4242- calling {!Mutex.lock} on Unix platforms. On Windows, recursive
4343- locking deadlocks.
4141+ @raise Sys_error if the mutex is already locked by the thread calling
4242+ {!Mutex.lock}.
44434544 @before 4.12 {!Sys_error} was not raised for recursive locking
4646- (platform-dependent behaviour).
4747-4848- @since 5.3 On Windows, {!Sys_error} is not raised for recursive
4949- locking. *)
4545+ (platform-dependent behaviour) *)
50465147val try_lock : t -> bool
5248(** Same as {!Mutex.lock}, but does not suspend the calling thread if
···5854(** Unlock the given mutex. Other threads suspended trying to lock
5955 the mutex will restart. The mutex must have been previously locked
6056 by the thread that calls {!Mutex.unlock}.
6161-6262- @raise Sys_error if the mutex is unlocked or was locked by another
6363- thread. This doesn't apply on Windows since OCaml 5.3.
5757+ @raise Sys_error if the mutex is unlocked or was locked by another thread.
64586559 @before 4.12 {!Sys_error} was not raised when unlocking an unlocked mutex
6666- or when unlocking a mutex from a different thread.
6767-6868- @since 5.3 On Windows, {!Sys_error} is not raised if the mutex is
6969- unlocked or was locked by another thread. *)
6060+ or when unlocking a mutex from a different thread. *)
70617162val protect : t -> (unit -> 'a) -> 'a
7263(** [protect mutex f] runs [f()] in a critical section where [mutex]
-1
testsuite/tests/lib-threads/mutex_errors.ml
···22 include systhreads;
33 hassysthreads;
44 no-tsan; (* tsan detects the mutex errors and fails *)
55- not-windows; (* Windows' SRWLock differ from pthreads ERRORCHECK mutexes. *)
65 {
76 bytecode;
87 }{