/usr/lib/ocaml/netsys/netsys_oothr.mli is in libocamlnet-ocaml-dev 3.7.3-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | (* $Id: netsys_oothr.mli 1529 2011-01-04 01:37:10Z gerd $ *)
(** Object-oriented thread API *)
(** Makes the most important multi-threading primitives available using
object types. For single-threaded apps, the operations are substituted
by no-ops.
*)
class type mtprovider =
object
method single_threaded : bool
(** Whether this is a single-threaded program. In this case, a number
of methods change their meaning, as described below.
*)
method create_thread : 's 't . ('s -> 't) -> 's -> thread
(** In a multi-threaded program: Starts a new thread, and calls the
passed function with the passed argument in the new thread
(like [Thread.create]).
In a single-threaded program: fails.
*)
method self : thread
(** In a multi-threaded program: Returns the currently running thread.
Subsequent calls of [self] can return different objects for the
same thread, but the [id] method will always return the same number.
In a single-threaded program: Returns a dummy object (see below).
*)
method yield : unit -> unit
(** In a multi-threaded program: gives a hint that another thread should
better run now.
In a single-threaded program: this is a no-op.
*)
method create_mutex : unit -> mutex
(** In a multi-threaded program: Creates a mutex and returns the object.
In a single-threaded program: Returns a dummy mutex object (see below).
*)
method create_condition : unit -> condition
(** In a multi-threaded program: Creates a condition variable and returns
the object.
In a single-threaded program: Returns a dummy variable (see below).
*)
end
and thread =
object
method id : int
(** In a multi-threaded program: Returns the thread ID.
In a single-threaded program: Returns 0.
*)
method join : unit -> unit
(** In a multi-threaded program: Suspends the calling thread until this
thread terminates.
In a single-threaded program: fails
*)
method repr : exn
(** May be used internally be the implementation *)
end
and mutex =
object
method lock : unit -> unit
(** In a multi-threaded program: Suspends the calling thread until the
mutex is locked.
In a single-threaded program: This is a no-op
*)
method unlock : unit -> unit
(** In a multi-threaded program: Unlocks a mutex.
In a single-threaded program: This is a no-op
*)
method try_lock : unit -> bool
(** In a multi-threaded program: Tries to immediately lock the mutex,
and returns whether the lock could be obtained.
In a single-threaded program: returns [true]
*)
method repr : exn
(** May be used internally be the implementation *)
end
and condition =
object
method wait : mutex -> unit
(** In a multi-threaded program: Wait for the condition to be true
and use the mutex to protect this situation.
In a single-threaded program: this is a no-op.
*)
method signal : unit -> unit
(** In a multi-threaded program: Signal one process that the condition
holds.
In a single-threaded program: this is a no-op.
*)
method broadcast : unit -> unit
(** In a multi-threaded program: Signal all waiting processes that the
condition holds.
In a single-threaded program: this is a no-op.
*)
method repr : exn
(** May be used internally be the implementation *)
end
val provider : mtprovider ref
(** Return the multi-threading provider *)
val serialize : mutex -> ('a -> 'b) -> 'a -> 'b
(** [serialize m f arg]: Locks [m], runs [f arg], unlocks [m], and returns
the result.
*)
|