mpsleep - General: Blocks the current kernel thread
long flags );
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
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
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.
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 complex lock structure that is associated with
some resource. If the MS_LOCK_NO_RELOCK flag is set, it
does not relock the lock after blocking. If the
MS_LOCK_ON_ERROR flag is set (or no flag is set), mpsleep
relocks the lock on failure.
This routine is not intended for general use. It is
mostly used by sleep and tsleep and by knowledgeable
The mpsleep routine cannot be called from within an Interrupt
Service routine (ISI) because it is illegal to block
at interrupt context.
The mpsleep routine returns the following values: Successful
completion. 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.
Routines: assert_wait_mesg(9r), clear_wait(9r),
thread_block(9r), thread_wakeup(9r), thread_wakeup_one(9r)
[ Back ]