[Boost-bugs] [Boost C++ Libraries] #7720: exception lock_error while intensive locking/unlocking of mutex

Subject: [Boost-bugs] [Boost C++ Libraries] #7720: exception lock_error while intensive locking/unlocking of mutex
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-11-22 08:43:37


#7720: exception lock_error while intensive locking/unlocking of mutex
---------------------------------------+------------------------------------
 Reporter: sergey.stepanov@… | Owner: anthonyw
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: thread
  Version: Boost 1.51.0 | Severity: Problem
 Keywords: lock_error |
---------------------------------------+------------------------------------
 Hi, Anthony and Vicente.

 ////////////////////////////////////////////
 #include <boost/thread/thread.hpp>
 using namespace boost;

 shared_mutex mtx;

 void f()
 {
     while (true)
     {
         upgrade_lock<shared_mutex> lock(mtx);
     }
 }

 void g()
 {
     while (true)
     {
         shared_lock<shared_mutex> lock(mtx);
     }
 }

 void h()
 {
     while (true)
     {
         unique_lock<shared_mutex> lock(mtx);
     }
 }

 int main()
 {
     thread t0(f);
     thread t1(g);
     thread t2(h);

     t0.join();
     t1.join();
     t2.join();

     return 0;
 }
 ////////////////////////////////////////////

 I ran this program and got exception boost::lock_error in some minutes.

 Used MS VS 2005 Version 8.0.50727.867, Boost C++ Libraries 1.51 and MS
 Windows 7 Pro version 6.1.7601 SP1.

 Regards, Sergey.

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