int Ns_TimedWaitForEvent( Ns_Event * event, Ns_Mutex * lock, int usec );
Same as Ns_WaitForEvent except that it has a timeout in seconds. On timeout, the function returns NS_TIMEOUT.
Ns_LockMutex(&lock); if (!ready) { result = Ns_TimedWaitForEvent(&ev, &lock, 10); if (result == NS_TIMEOUT) { ... handle timeout ... } else if (result != NS_OK) { ... handle error ... } } Ns_UnlockMutex(&lock);