Unconditionally wake up a sleeping thread.
CS_RETCODE srv_ucwakeup(spp, wakeflags) SRV_PROC *spp; CS_INT wakeflags;
A pointer to an internal thread control structure.
A bit mask that modifies the way srv_ucwakeup behaves. Just one flag is defined; set wakeflags to 0 if it is not used.
This flag indicates that the call to srv_ucwakeup is from interrupt level code. Failure to set this flag when calling srv_ucwakeup from interrupt level code can cause the Open Server application to behave erratically.
Returns |
To indicate |
---|---|
CS_SUCCEED |
The routine completed successfully. |
CS_FAIL |
The routine failed, because the thread does not exist or was not sleeping. |
#include <ospublic.h> /* ** Local Protoype. */CS_RETCODE ex_srv_ucwakeup PROTOTYPE(( SRV_PROC *sproc )); /* ** EX_SRV_PROC ** An example routine to wake up a sleeping thread from ** a non-interrupt level by using srv_ucwakeup. ** ** Arguments: ** sproc A pointer to an internal thread control ** structure. ** ** Returns: ** CS_SUCCEED The specified thread was woken up. ** CS_FAIL An error was detected. */ CS_RETCODE ex_srv_ucwakeup(sproc) SRV_PROC *sproc; { /* Wake up the specified thread. */ return( srv_ucwakeup(sproc, 0)); }
Waking a thread with srv_ucwakeup causes srv_sleep to return SRV_I_INTERRUPTED.
Use srv_ucwakeup to wake a thread unconditionally. This may be necessary to break a deadlock condition or for cleanup.
srv_ucwakeup cannot be used in a SRV_START handler.
If srv_ucwakeup is called from interrupt level code, wakeflags must be set to SRV_M_WAKE_INTR. wakeflags must never be set to SRV_M_WAKE_INTR outside of an interrupt level routine.