Subject: Re: [Boost-bugs] [Boost C++ Libraries] #3628: condition.notify_one() does not wake up a thread that is in condition.wait() or condition.timed_wait()
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-11-26 14:36:50
#3628: condition.notify_one() does not wake up a thread that is in
condition.wait() or condition.timed_wait()
--------------------------------------------------+-------------------------
Reporter: Shouaib Ahmed <ranashoaib@â¦> | Owner: anthonyw
Type: Bugs | Status: new
Milestone: Boost 1.41.0 | Component: thread
Version: Boost 1.40.0 | Severity: Problem
Keywords: condition |
--------------------------------------------------+-------------------------
Comment(by Shouaib Ahmed <ranashoaib@â¦>):
Replying to [comment:2 viboes]:
> Replying to [ticket:3628 Shouaib Ahmed <ranashoaib@â¦>]:
> > You can see in the attached project's TestBoostThread.cpp file that in
ThreadFuncWaiter(), the thread is in timed_wait() call before it releases
the mutex to let the ThreadFuncNotifier() thread notify it. But inside
notify_one(), most of the time it will choose not to notify any "waiter".
The total_count class member is 0 when that happens. If I uncomment the
three lines marked as WORKAROUND_ in TestBoostThread.cpp, then the threads
will be notified, but this is just a workaround.
>
> Have you tried to protect with a mutex the theConditions variable? This
variable is used by ThreadFuncNotifier() and ThreadFuncWaiter().
It is protected by a mutex. May be you overlooked that.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/3628#comment:3> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:01 UTC