srv_timedsleep

Description

Sleep until an event is signalled or until the specified time expires.

Syntax

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:

Parameters

sleepevent

A generic pointer to the event to sleep on.

sleeplabel

A pointer to a string for debugging puposes.

sleepflags

This parameter is not used.

infop

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

srvmutex

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.

timeout

A timeout in milliseconds.

Returns

Table 3-144:  Return values (srv_timedsleep)

Returns

To indicate

CS_SUCCEED

The routine succeeded.

CS_FAIL

The routine failed. See the infop parameter for more information.

Usage

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.

See also

srv_wakeup