This is the mail archive of the libc-help@sourceware.org mailing list for the glibc 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]

pthread_cond_timedwait vs pthread_mutex_timedlock


It's not clear to me which one I should use. I have a log-flushing thread that I need to wake every X seconds and flush the log (and also wake when signaled by a full log buffer or log destructor--by unlocking the mutex if I had used a mutex, or signaling the condition if I had used that).

What is most important to me is to guarantee that no busy wait will occur.

A possible complication is that I need my code to build on both Linux and Windows, so I'm using pthreads for Win32/64 in the latter case.


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