> I'm not sure I understand: is the problem that thread 1 might update twice
> and at least one of threads 2 to n might miss a transition?
The problem is that thread 2: can send data before or after thread 1 has
executed. A race condition I guess you'd call it.
The pthread_cond_wait/broadcast logic assumes thread 1 to be in a wait state
for thread 2, to signal it and wake it up.
This is no good if thread 2 is finished it's execution before thread 1 has put
itself into a wait state.
So either thread 2, polls a shared variable to await thread 1, being in a sleep
state (naff and ineffecient) or thread 1, I guess does a similar sort of
polling on a shared file descriptor which I'm hoping will allow me not to have
to block in the signalling thread.
The real problem is that I'm trying to replace a Windows IOCompletion blob of
logic with a pthread solution (GNU points++;), but, the Windows IOCompletion
ports are asynchronous, whereas the pthread_condition/broadcast sets of logic
Basically I'm going to introduce latency into the application by polling a
shared state variable/descriptor. I'd like to avoid that if at all possible.
Embedded Software Engineer
Europlex Technologies Ltd
Clonshaugh Business & Technology Park
T:+353 (0) 1 2500500
F:+353 (0) 1 2500590
E:bryano at euoplex.ie
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!