28 Mar
2008
28 Mar
'08
8:03 p.m.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Friday 28 March 2008 14:28 pm, Raider wrote:
boost::condition Condition; ...
void Thread1() { MyCode::CreateThread2(); boost::mutex m; boost::mutex::scoped_lock l(m); if (!Condition.timed_wait(l, make500msdelay())) ... }
void Thread2() { Condition.notify_all(); }
Am I using boost::condition right way? Is `m' mutex nessesary?
It looks like you need to lock m in Thread2, to insure the notify doesn't happen before Thread1 starts waiting on it. - -- Frank -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFH7U8a5vihyNWuA4URAuNFAKCGwsTYBqVewizUOR2o2UcnCKGXwwCdH4Rp UJOLnnuHwqfAJAmvqHcciYs= =MLco -----END PGP SIGNATURE-----