|
Boost Users : |
Subject: Re: [Boost-users] Condition Variable Notify
From: Frank Birbacher (bloodymir.crap_at_[hidden])
Date: 2012-03-22 18:37:46
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi!
Am 22.03.12 19:51, schrieb Matt Fair:
> So my questions are: 1. Does anything look off, am I using the
> condition variable and mutex correctly?
What looks odd to me is the bool flag variable: it should be declared
volatile. It might be it is not updated correctly.
> 2. In waitForAck, I have a scope_lock that is locked, when I enter
> into timed_wait, does this unlock the mutex and the re-locks it
> when m_ackCond.notify_one() is called?
Yes. This is exactly the reason for why you need to pass the lock to
the wait function.
HTH,
Frank
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: keyserver x-hkp://pool.sks-keyservers.net
iEYEARECAAYFAk9rqboACgkQhAOUmAZhnmpIugCeIWjLM0Vz6BQIkIEM9w1l7jfT
s9IAnRxWaXcllMOAEcfIvyZY7ckGzE7k
=MsF5
-----END PGP SIGNATURE-----
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