[Boost-bugs] [Boost C++ Libraries] #7772: Incorrect condition_variable::notify_one (win32 vc9)

Subject: [Boost-bugs] [Boost C++ Libraries] #7772: Incorrect condition_variable::notify_one (win32 vc9)
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-12-07 09:40:38


#7772: Incorrect condition_variable::notify_one (win32 vc9)
------------------------------------+---------------------------------------
 Reporter: jaime.legido@… | Owner: anthonyw
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: thread
  Version: Boost 1.52.0 | Severity: Regression
 Keywords: win32 vc9 |
------------------------------------+---------------------------------------
 When someone calls condition_variable::notify_one never
 "generations.erase" removes any element.

 In versión 1.52 this code has been changed
 thread\win32\condition_variable.hpp:196
 struct entry_manager
 {
 ...
                 ~entry_manager()
                 {
                   if(! entry->is_notified())
                   {
                     entry->remove_waiter();
                   }
                 }
 ...

 Never call "entry->remove_waiter()" therefore not remove anything from
 generations vector.



 Code example

 #define BOOST_THREAD_USE_DLL
 #include <boost/thread.hpp>

 boost::condition_variable cv;
 boost::mutex mt;
 void fTest()
 {
         boost::mutex::scoped_lock sl(mt);
         while(1)
         {
                 cv.wait(sl);
         }
 }

 int _tmain(int argc, _TCHAR* argv[])
 {
         boost::thread th = boost::thread(boost::bind(&fTest));

         while(1)
         {
                 cv.notify_one();
                 boost::this_thread::sleep(boost::posix_time::seconds(1));
         }

         return 0;
 }

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/7772>
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:11 UTC