 |
Index for Section 9r |
|
 |
Alphabetical listing for M |
|
 |
Bottom of page |
|
mpsleep(9r)
NAME
mpsleep - General: Blocks the current kernel thread
SYNOPSIS
int mpsleep(
caddr_t channel,
long pri,
char *wmesg,
long timo,
void *lockp,
long flags );
ARGUMENTS
channel
Specifies an address associated with the calling kernel thread to be
blocked.
pri Can specify the following values:
PCATCH 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.
PSUSP 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.
wmesg
Specifies a mnemonic for the type of wait. The ps command uses this
mnemonic in its messages about the process.
timo
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.
lockp
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).
flags
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:
MS_LOCK_SIMPLE
Calls mpsleep with a simple lock asserted.
MS_LOCK_READ
Calls mpsleep with a read-only lock asserted on entry.
MS_LOCK_WRITE
Calls mpsleep with a write lock asserted.
In addition, you can specify one of the following ways to handle the
lock after blocking:
MS_LOCK_ON_ERROR
Forces mpsleep to relock the lock on failure.
MS_LOCK_NO_RELOCK
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 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.
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:
0 Successful completion.
EINTR The sleep has been interrupted by a signal.
ERESTART
The sleep has been interrupted by a signal on a restartable system
call.
EWOULDBLOCK
The timeout has expired.
SEE ALSO
Routines: assert_wait_mesg(9r), clear_wait(9r), thread_block(9r),
thread_wakeup(9r), thread_wakeup_one(9r)
 |
Index for Section 9r |
|
 |
Alphabetical listing for M |
|
 |
Top of page |
|