learningunix
asked on
cond timewai
int cond_timedwait(cond_t *cond, mutex_t *mutex, timestruc_t *abstime);
cond_timedwait automatically releases the mutex, and waits on the condition variable cond. When the condition is signaled or the time expires, cond_timedwait reacquires the mutex and returns to the caller.
What if after time expires, the mutex is locked by some other process? in that case cond_timedwait will not be able to re-acquire the mutex?
cond_timedwait automatically releases the mutex, and waits on the condition variable cond. When the condition is signaled or the time expires, cond_timedwait reacquires the mutex and returns to the caller.
What if after time expires, the mutex is locked by some other process? in that case cond_timedwait will not be able to re-acquire the mutex?
ASKER
I understand but what if that mutex is already acuired by some other thread while this was waiting.
The time expires now if it tries to acquire the lock shouldn't that fail? how do we can confirm that?
The time expires now if it tries to acquire the lock shouldn't that fail? how do we can confirm that?
ASKER
or will it just wait until the other thread releases the lock and this can re-acquire?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
got it
This information should be listed in the man page for cond_timedwait.