Sleep until an event is signalled or until the specified time expires.
CS_RETCODE srv_timedsleep(sleepevent, sleeplabel, sleepflags, infop, srvmutex)
CS_VOID *sleepevent; CS_CHAR *sleeplabel; CS_INT sleepflags; CS_VOID *infop; SRV_OBJID srvmutex; CS_INT timeout:
A generic pointer to the event to sleep on.
A pointer to a string for debugging puposes.
This parameter is not used.
A pointer to an integer describing the reason for a failure. The following are the integer values for infop:SRV_1_UNKNOWN — Unknown or no error
SRV_1_TIMEOUT — The routine timed out
SRV_1_INTERRUPTED — The srvlib process executing this function was interrupted by a call to srv_ucwakeup().
When this function returns SRV_1_INTERRUPTED,
the srvlib process is interrupted while waiting on the event or
while attempting to lock the mutex.
A srvlib mutex to be released when sleeping, and which will be locked after wakeup. Enter 0 if you do not want srv_timedsleep() to release and lock a mutex.
A timeout in milliseconds.
Returns |
To indicate |
---|---|
CS_SUCCEED |
The routine succeeded. |
CS_FAIL |
The routine failed. See the infop parameter for more information. |
It is possible to pass a mutex into this function for synchronization with a wakeup: The mutex will be released at such a point that another thread which obtains the mutex lock and then calls srv_wakeup() , for this event, succeeds in waking up the srvlib process executing this sleep function. If the routine returns CS_SUCCEED the srvlib mutex will be locked. It will not be locked by this thread if the routine returns CS_FAIL.