Boost logo

Boost Users :

From: Roland Schwarz (roland.schwarz_at_[hidden])
Date: 2005-09-09 10:32:12


Johan 't Hart schrieb:

>Thanks for your replies.
>
>To me boost::condition looks very much like the old event variable, except
>that it works together with a mutex. I am now wondering why you should lock
>a mutex before waiting for the condition? Is there a rationale about this?
>
>
>
I recommend getting a book on pthreads (Posix Threads). E.g.
"Programming with
POSIX Threads" David. R. Butenhof.

You will understand then why the sole combination of mutex and condition
valiables
will solve (almost) every MT need.
I said almost because there is on some platforms (Win32) an inherent
inability to cancel out
of blocking IO calls. However the clever guys that ported pthreads to
Win32 solved
a lot of these problems.

You might also look into my thread_alert submission which is in the
boost file vault.
It does address this later issue to some degree.

Regards,
Roland


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net