Waits on the condition variable for a limited time.
#include <nks/synch.h> int NXCondTimedWait( NXCond_t *cond, NXMutex_t *mutex, unsigned long interval);
(IN) Points to the condition variable to wait on.
(IN) Points to a mutually exclusive lock held by the calling thread.
(IN) Specifies the maximum amount of time you are willing to wait (expressed in the number of system ticks from the point of blocking).
If successful, returns zero; otherwise, returns a nonzero error code:
NXCondTimedWait atomically releases the entry lock pointed to by mutex and blocks the calling thread. When the condition is signaled, NXCondTimedWait reacquires the mutex and returns.
NOTE:It is the responsibility of the calling thread to re-evaluate the entry condition when NXCondTimedWait returns. The condition might have been consumed by a different thread between the time when a blocked thread within NXCondTimedWait awakens and when it acquires the entry mutex.
Two cases are viewed as errors:
The wait can be interrupted, in which case NXCondTimedWait returns NX_EINTR.
If the condition is not signaled (with respect to the calling thread) within the specified interval (measured from the point of blocking), the interval expires and NXCondTimedWait returns NX_ETIMEDOUT.
If an error occurs, the entry lock is not held when NXCondTimedWait returns.