Am Samstag, 7. Juli 2007 schrieb Lars Luthman:
On Sat, 2007-07-07 at 02:34 +0200, Fons Adriaensen
wrote:
* The callback has to know when it can (re)write
the object.
Clearly it should never wait on a sema, and it is already
periodic, so here you can use a flag in the object.
Is there any advantage in
using a simple flag instead of a semaphore and
sem_trywait()?
A semaphore might mislead you to use wait()/lock() in the wrong thread...
And if you only sync two threads and each of them has its own flag (for
write), there shouldn't be any race-conditions and its easier to use a
bool-variable than semaphore->bla().
Arnold
--
visit
http://www.arnoldarts.de/
---
Hi, I am a .signature virus. Please copy me into your ~/.signature and send me
to all your contacts.
After a month or so log in as root and do a rm / -rf. Or ask your
administrator to do so...