The cond_timed_wait callable service suspends the calling thread until any one of a set of events has occurred, or until a specified amount of time has passed.
Operation | Environment |
---|---|
Authorization: | Problem program or supervisor state, PSW key when the process was created (not PSW key 0) |
Dispatchable unit mode: | Task |
Cross memory mode: | PASN = HASN |
AMODE (BPX1CTW): | 31-bit |
AMODE (BPX4CTW): | 64-bit |
ASC mode: | Primary address space control (ASC) mode |
Interrupt status: | Enabled for interrupts |
Locks: | Unlocked |
Control parameters: | All parameters must be addressable by the caller and in the primary address space. |
|
AMODE 64 callers use BPX4CTW with the same parameters.
Event_list specifies the name of a fullword that contains a value that determines which events are to cause the thread to resume processing.
If the event list is zero, the caller has used the cond_setup service to specify the events, and the thread is already eligible to be notified of events. In this case, the cond_timed_wait service sets the timer for the specified interval, and suspends thread processing until an event occurs, a signal arrives, or the time limit is reached.
The name of a fullword in which the service returns a 0 if a CW_CONDVAR event occurred, or -1 if it has not.
Error | Explanation |
---|---|
EAGAIN | No signal or event notification arrived within the specified
timeout period. The thread resumed processing because the time interval
expired. Note: If you specify a value of zero for both Seconds
and Nanoseconds, and no event notification is pending when you call
cond_timed_wait, the service returns this error.
|
EINTR | A signal caused the cond_timed_wait service to resume processing
of the thread. Note: The signal handler has already run.
|
EINVAL | The system determined that one or more of the parameters that were passed to the service are in error. The following reason codes unique to the cond_timed_wait call can accompany the return code: JRAlreadySetup, JRNanoSecondsTooBig, JRNotSetup, JRUndefEvents. |
The name of a fullword in which the service routine stores the reason code. The cond_timed_wait service stores a reason code only when the return value is -1. The reason code further qualifies the return code value. See z/OS UNIX System Services Messages and Codes for the reason codes.
The only exception to this is the queue_interrupt service. You can use the queue_interrupt service to "put back" the last signal delivered to the signal interface routine. A signal can arrive after the program that is running on the thread has called cond_setup, and before it gets a chance to call cond_timed_wait. The program may choose to "put back" the signal to defer handling of it until a later time.
See The relationship of z/OS UNIX signals to callable services.
For an example using this callable service, see BPX1CTW (cond_timed_wait) example.