Sleep until an event is signalled or until the specified time expires. srv_timedsleep is available in the reentrant libraries only.
CS_RETCODE srv_timedsleep(sleepevent, sleeplabel, sleepflags, infop, srvmutex, timeout)
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 used and performs the same usage as srv_sleep in suspending currently executing threads.
A pointer to an integer describing the reason for a failure. The following are the integer values for infop:
SRV_I_UNKNOWN — Unknown or no error
SRV_I_TIMEOUT — The routine timed out
SRV_I_INTERRUPTED — The srvlib process executing this function was interrupted by a call to srv_ucwakeup().
When this function returns SRV_I_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. Pass 0 to block indefinitely.
Returns |
To indicate |
---|---|
CS_SUCCEED |
The routine succeeded. |
CS_FAIL |
The routine failed. See the infop parameter. |
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.