This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Threading problem


I am facing a peculier problem in threads. This is a problem of condition
variables. My one functions is waiting infinitely to get a signal. Even when
I deliver a signal, it is not caught in the other function which is waiting
for an infinite amount of time to recieve the signal and proceed further.
Further speaking I replaced this by broadcast. I have failed in that also.
So I replaced infinite timed wait with wait for 1 sec in a conditional while
loop with a predicate check and this works fine. To further my observations

Is there a defect in thread implementations or we just should not check
conditions this with the usage of any predicates. We always see the
following statement for threads in man pages
When using condition variables there is always a Boolean predicate involving
shared variables associated with each condition wait that is true if the
thread should proceed. Spurious wakeups from the pthread_cond_timedwait() or
pthread_cond_wait() functions may occur. Since the return from
pthread_cond_timedwait() or pthread_cond_wait() does not imply anything
about the value of this predicate, the predicate should be re-evaluated upon
such return.

If u can suggest any thread mailing groups also, It shall be of great usage.
Regards
Vikas


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]