module Thread:sig
..end
1003.1c
and Win32.type
t
val create : ('a -> 'b) -> 'a -> t
Thread.create funct arg
creates a new thread of control,
in which the function application funct arg
is executed concurrently with the other threads of the program.
The application of Thread.create
returns the handle of the newly created thread.
The new thread terminates when the application funct arg
returns, either normally or by raising an uncaught exception.
In the latter case, the exception is printed on standard error,
but not propagated back to the parent thread. Similarly, the
result of the application funct arg
is discarded and not
directly accessible to the parent thread.val self : unit -> t
val id : t -> int
val exit : unit -> unit
val kill : t -> unit
val delay : float -> unit
delay d
suspends the execution of the calling thread for
d
seconds. The other program threads continue to run during
this time.val join : t -> unit
join th
suspends the execution of the calling thread
until the thread th
has terminated.val wait_read : Unix.file_descr -> unit
Thread.wait_write
.val wait_write : Unix.file_descr -> unit
val wait_timed_read : Unix.file_descr -> float -> bool
val wait_timed_write : Unix.file_descr -> float -> bool
wait_read
) or
one character can be written without blocking (wait_write
)
on the given Unix file descriptor. Wait for at most
the amount of time given as second argument (in seconds).
Return true
if the file descriptor is ready for input/output
and false
if the timeout expired.
These functions return immediately true
in the Win32
implementation.
val select : Unix.file_descr list ->
Unix.file_descr list ->
Unix.file_descr list ->
float -> Unix.file_descr list * Unix.file_descr list * Unix.file_descr list
Unix.select
.
This function is not implemented yet under Win32.val wait_pid : int -> int * Unix.process_status
wait_pid p
suspends the execution of the calling thread
until the process specified by the process identifier p
terminates. Returns the pid of the child caught and
its termination status, as per Unix.wait
.
This function is not implemented under MacOS.val yield : unit -> unit
Thread.sigmask
. This set is inherited at thread creation time.
Per-thread signal masks are supported only by the system thread library
under Unix, but not under Win32, nor by the VM thread library.val sigmask : Unix.sigprocmask_command -> int list -> int list
sigmask cmd sigs
changes the set of blocked signals for the
calling thread.
If cmd
is SIG_SETMASK
, blocked signals are set to those in
the list sigs
.
If cmd
is SIG_BLOCK
, the signals in sigs
are added to
the set of blocked signals.
If cmd
is SIG_UNBLOCK
, the signals in sigs
are removed
from the set of blocked signals.
sigmask
returns the set of previously blocked signals for the thread.val wait_signal : int list -> int
wait_signal sigs
suspends the execution of the calling thread
until the process receives one of the signals specified in the
list sigs
. It then returns the number of the signal received.
Signal handlers attached to the signals in sigs
will not
be invoked. The signals sigs
are expected to be blocked before
calling wait_signal
.