Solved

cond timewai

Posted on 2011-03-04
5
313 Views
Last Modified: 2012-05-11
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?
0
Comment
Question by:learningunix
  • 3
  • 2
5 Comments
 
LVL 53

Expert Comment

by:Infinity08
ID: 35039379
If the timeout expires, cond_timedwait will re-acquire the mutex, and return ETIME.

This information should be listed in the man page for cond_timedwait.
0
 

Author Comment

by:learningunix
ID: 35039520
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?
0
 

Author Comment

by:learningunix
ID: 35039530
or will it just wait until the other thread releases the lock and this can re-acquire?
0
 
LVL 53

Accepted Solution

by:
Infinity08 earned 250 total points
ID: 35039632
>> or will it just wait until the other thread releases the lock and this can re-acquire?

Correct.
0
 

Author Closing Comment

by:learningunix
ID: 35046544
got it
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now