Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] Re: vdr 1.3.18 cCondWait::SleepMs



Rainer Zocholl wrote:
Hello


Wouldn't it be use full if (some kind of) cCondWait::SleepMs returns
the result of cCondWait::Wait so the calling thread might be
able to do some houskeeping in the case of an termination signal
and does not continue to call the SleepMs?

Especially as "signaled" is reset which every call to SleepMs
and termination of Wait.

Else i don't see what's the sense of "signaled".
Isn't redundant if it is cleared outside the "constructor"?


AFAIK pthread_cond_timedwait unlocks the mutex.
Only on timeout it becomes relocked, not on "condition".
Why is it unlocked a second time at the end of the function
regardless of the state of "signaled" ?



BTW:
http://www2.yo-linux.com/cgi-bin/man.cgi?section=all&topic=pthread_cond_timedwait

ASYNC-SIGNAL SAFETY

The condition functions are not async-signal safe, and should not be called from a signal handler. In particular, calling pthread_cond_signal or pthread_cond_broadcast from a signal handler may deadlock the calling thread.


Where is cCondWait::Signal called from?
cCondWait::SleepMs() is just used as a replacement for the previous
usleep(), since there was a lot of ado about usleep() not giving up its
time slice etc. There's no need for cCondWait::SleepMs() to return anything.

If you can suggest a better way of just waiting some milliseconds while
giving up the time slice, please advise.

Klaus




Home | Main Index | Thread Index