|
Boost Users : |
From: Frank Mori Hess (fmhess_at_[hidden])
Date: 2008-04-19 19:19:46
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Saturday 19 April 2008 10:23, Frank Mori Hess wrote:
> On Saturday 19 April 2008 06:48, Anteru wrote:
> > Well, I still have problems with the conditions, even with the latest
> > SVN. The problem seems to be that inside a block like:
>
> Does the attached patch help? I do my development on Linux, so it's
> completely untested.
Actually, I no longer think my earlier patch was useful. But what if the
last notify_one() happens between the WaitForSingleObject() call in
do_wait() and the start_wait_loop() call in the next iteration of the
while loop? I don't understand the boost.thread code 100%, but it seems
like it could be missed. The attached patch should eliminate that
possibility.
- --
Frank
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFICn4U5vihyNWuA4URApf/AJ9XoHwrN24icBpuRseMWHSi/PkibgCfUp01
iZfWAl76xeBJniBsdMkARyM=
=5pJn
-----END PGP SIGNATURE-----
--Boundary-00=_U4nCIyzRT4vY1t3
Content-Type: text/x-diff;
charset="utf-8";
name="thread_win_cv_2.patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="thread_win_cv_2.patch"
Index: boost/thread/win32/condition_variable.hpp
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=2D-- boost/thread/win32/condition_variable.hpp (revision 44607)
+++ boost/thread/win32/condition_variable.hpp (working copy)
@@ -164,7 +164,6 @@
detail::win32::handle_manager& local_wake=
_sem,
detail::win32::handle_manager& sem)
{
=2D boost::mutex::scoped_lock internal_lock(internal_mutex);
if(!local_wake_sem)
{
start_wait_loop_first_time(locker,local_wake_sem);
@@ -184,15 +183,18 @@
=20
relocker<lock_type> locker(lock);
=20
+ boost::unique_lock<boost::mutex> internal_lock(internal_mu=
tex);
while(!woken)
{
start_wait_loop(locker,local_wake_sem,sem);
+ internal_lock.unlock();
=20
if(!this_thread::interruptible_wait(sem,wait_until))
{
return false;
}
=20
+ internal_lock.lock();
unsigned long const woken_result=3Ddetail::win32::Wait=
=46orSingleObject(local_wake_sem,0);
BOOST_ASSERT(woken_result=3D=3Ddetail::win32::timeout =
|| woken_result=3D=3D0);
=20
--Boundary-00=_U4nCIyzRT4vY1t3--
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