Forces the calling kernel thread to wait for the occurrence of a shared event.
#include <sys/types.h> #include <sys/errno.h> #include <sys/sleep.h> int e_sleep ( event_word, flags) tid_t *event_word; int flags;
Item | Description |
---|---|
event_word | Specifies the shared event word. The kernel uses the event_word parameter to anchor the list of processes sleeping on this event. The event_word parameter must be initialized to EVENT_NULL before its first use. |
flags | Specifies the flags that control action on occurrence of
signals. These flags can be found in the /usr/include/sys/sleep.h file.
The flags parameter is used to control how signals affect
waiting for an event. The following flags are available to the e_sleep service:
|
The e_sleep kernel service is used to wait for the specified shared event to occur. The kernel places the current kernel thread on the list anchored by the event_word parameter. This list is used by the e_wakeup service to wake up all threads waiting for the event to occur.
The anchor for the event list, the event_word parameter, must be initialized to EVENT_NULL before its first use. Kernel extensions must not alter this anchor while it is in use.
The e_wakeup service does not wake up a thread that is not currently sleeping in the e_sleep function. That is, if an e_wakeup operation for an event is issued before the process calls the e_sleep service for the event, the thread still sleeps, waiting on the next e_wakeup service for the event. This implies that routines using this capability must ensure that no timing window exists in which events could be missed due to the e_wakeup service being called before the e_sleep operation for the event has been called.
The e_sleep kernel service can be called from the process environment only.
Item | Description |
---|---|
EVENT_SUCC | Indicates a successful operation. |
EVENT_SIG | Indicates that the EVENT_SIGRET flag is set and the wait is terminated by a signal. |