mpsleep(9r)mpsleep(9r)NAMEmpsleep - General: Blocks the current kernel thread
SYNOPSIS
int mpsleep(
caddr_t channel,
long pri,
char *wmesg,
long timo,
void *lockp,
long flags );
ARGUMENTS
Specifies an address associated with the calling kernel thread to be
blocked. Can specify the following values: When set, specifies that
the sleep request is interruptible. That is, the kernel thread can
take asynchronous signals. Not setting the PCATCH flag causes the
process to sleep in an uninterruptible state. When set, specifies that
the process can be asynchronously suspended while waiting.
On the operating system you cannot use pri to set the scheduling
priority of the calling process. Specifies a mnemonic for the
type of wait. The ps command uses this mnemonic in its messages
about the process. Specifies the maximum amount of time the
kernel thread should block. The kernel thread blocks a maximum
of timo divided by hz seconds. If you pass the value 0 (zero),
mpsleep assumes there is no timeout. Specifies a pointer to a
lock structure that you want to unlock before the process
sleeps. If you do not want to release a lock, pass the value 0
(zero). Specifies the lock type of the lockp argument and how
to handle the lock after blocking.
You can specify one of the following valid lock types, defined
in the <param.h> file: Calls mpsleep with a simple lock
asserted. Calls mpsleep with a read-only lock asserted on
entry. Calls mpsleep with a write lock asserted.
In addition, you can specify one of the following ways to handle
the lock after blocking: Forces mpsleep to relock the lock on
failure. Forces mpsleep not to relock after blocking.
DESCRIPTION
The mpsleep routine blocks (puts to sleep) the current kernel thread
until a wakeup is issued on the address you specify in the channel
argument. This routine is the symmetric multiprocessor (SMP) sleep
call. The kernel thread blocks a maximum of timo divided by hz seconds.
The value0 (zero) means there is no timeout.
If you pass the PCATCH flag to the pri argument, the sleep request is
interruptible, and the kernel thread can take asynchronous signals. If
you pass the PSUSP flag, the process can be asynchronously suspended
while waiting.
The mpsleep routine allows you to specify a pointer to a simple or com‐
plex lock structure that is associated with some resource. If the
MS_LOCK_NO_RELOCK flag is set, it does not relock the lock after block‐
ing. If the MS_LOCK_ON_ERROR flag is set (or no flag is set), mpsleep
relocks the lock on failure.
NOTES
This routine is not intended for general use. It is mostly used by
sleep and tsleep and by knowledgeable callers.
The mpsleep routine cannot be called from within an Interrupt Service
routine (ISI) because it is illegal to block at interrupt context.
RETURN VALUES
The mpsleep routine returns the following values: Successful comple‐
tion. The sleep has been interrupted by a signal. The sleep has been
interrupted by a signal on a restartable system call. The timeout has
expired.
SEE ALSO
Routines: assert_wait_mesg(9r), clear_wait(9r), thread_block(9r),
thread_wakeup(9r), thread_wakeup_one(9r)mpsleep(9r)