/** @memo @doc @precondition @return */ int _rtp_debug_sig_semaphore_wait_timed ( RTP_SEMAPHORE semHandle, long msecs, const char *file, long line_num ) { RTPSemaphoreHeader* pSemaphoreHead = (RTPSemaphoreHeader*)semHandle; int result; if (!__rtp_TrackingSemaphoreHeader(pSemaphoreHead)) { /* ----------------------------------- */ /* This semaphore does not */ /* exist on the track list. */ /* ----------------------------------- */ return (_rtp_sig_semaphore_wait_timed(semHandle, msecs)); } if (__rtp_InitSemaphoreDebug()) { _rtp_sig_mutex_claim(rtpSemaphoreDebugLock); pSemaphoreHead->seq = guWaitSequence++; pSemaphoreHead->wait = msecs; pSemaphoreHead->state = gcSemaphoreWaitTimed; rtp_strcpy(pSemaphoreHead->file, file); pSemaphoreHead->line = line_num; _rtp_sig_mutex_release(rtpSemaphoreDebugLock); result = _rtp_sig_semaphore_wait_timed(pSemaphoreHead->sem, msecs); } return (result); }
/*----------------------------------------------------------------------* _rtp_sig_semaphore_clear *----------------------------------------------------------------------*/ void _rtp_sig_semaphore_clear (RTP_HANDLE semHandle) { while (_rtp_sig_semaphore_wait_timed (semHandle, 0) == 0) { ; } }
/** @memo Wait for a mutex to be available. @doc Wait for a mutex to be available. If the mutex is already available this function returns immediatley, otherwise it should block until the mutex is available or the millisecond time value has expired. Use 0 to poll the mutex and return with its state immediately. Use -1 to indicate that an infinite timeout value should be used, blocking indefinitely for the mutex to become available. @precondition Must not call directly. Use the <b>rtp_sig_mutex_claim_timed</b> macro in rtpsignl.h. Also note that for every time this function is successful on a designated mutex handle, a respective call to _rtp_sig_mutex_release must be made. @return 0 if successful, -1 on error, and 1 if the call timed out. For debugging purposes; if the cause of the error is obtainable at the native Kernel layer, turn on RTP_DEBUG in rtpdebug.h to display the native error value. */ int rtp_sig_mutex_claim_timed ( RTP_HANDLE mutexHandle, /** Handle to the mutex to be checked. */ long msecs /** Timeout value in milliseconds:<br> <pre> | 0 To poll. | -1 To indicate use of infinite. </pre> */ ) { return (_rtp_sig_semaphore_wait_timed (mutexHandle, msecs) != 0); }