WaitSignal

Waits until a signal is received.

Synopsis

int32 WaitSignal( uint32 sigMask )

Description

This procedure puts the calling task into wait state until any of the signal(s) specified in the sigMask have been received. When a task is in wait state, it uses no CPU time.

When WaitSignal() returns, bits set in the result indicate which of the signal(s) the task was waiting for were received since the last call to WaitSignal(). (The SIGF_ABORTED bit is also set if that signal was received, even if it is not in the signal mask.) If the task was not waiting for certain signals, the bits for those signals remain set in the task's signal word, and all other bits in the signal word are cleared.

See AllocSignal() for a description of the implementation of signals.

Arguments

sigMask
A mask in which bits are set to specify the signals the task wants to wait for.

Return Value

The procedure returns a mask that specifies which of the signal(s) a task was waiting for have been received or an error code (a negative value) if an error occurs. Possible error codes include:

ILLEGALSIGNAL
One or more of the signal bits in the sigMask argument was not allocated by the task.

Implementation

SWI implemented in kernel folio V20.

Associated Files

task.h
ANSI C Prototype

Notes

Because it is possible for tasks to send signals in error, it is up to tasks to confirm that the actual event occurred when they receive a signal.

For example, if you were waiting for SIGF_IODONE and the return value from WaitSignal indicated that the signal was sent, you should still call CheckIO using the IOReq to make sure it is actually done. If it was not done you should go back to WaitSignal.

See Also

SendSignal()