[boost.threads] condition api question
I'm curious why the boost::condition class requires a seperate mutex object to be created, and a corresponding scoped lock argument passed to the wait functions. Wouldn't it be easier to just keep a mutex inside the condition object and automatically lock it at the beginning of the wait functions? What am I missing here? -- Frank
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Tuesday 30 January 2007 12:54 pm, Frank Mori Hess wrote:
I'm curious why the boost::condition class requires a seperate mutex object to be created, and a corresponding scoped lock argument passed to the wait functions. Wouldn't it be easier to just keep a mutex inside the condition object and automatically lock it at the beginning of the wait functions? What am I missing here?
Ah, nevermind. I remember now sometimes you want to do: 1) lock 2) launch thread that will lock then notify 3) wait - -- Frank -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQFFv7jB5vihyNWuA4URApoMAKCU4hWxherIjm13GiHWHtOpqF1D7ACg2/gY bU/Q2s5C1v6FZCyyupQq/dc= =/tYS -----END PGP SIGNATURE-----
participants (1)
-
Frank Mori Hess