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

Subject: Re: [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-23 06:36:01


#7720: exception lock_error while intensive locking/unlocking of mutex
----------------------------------------+-----------------------------------
  Reporter: sergey.stepanov@… | Owner: viboes
      Type: Bugs | Status: assigned
 Milestone: To Be Determined | Component: thread
   Version: Boost 1.51.0 | Severity: Problem
Resolution: | Keywords: lock_error
----------------------------------------+-----------------------------------
Changes (by viboes):

  * owner: anthonyw => viboes
  * status: new => assigned


Old description:

> 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.

New description:

 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.

--
Comment:
 Please, could you try defining
 BOOST_THREAD_PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN to see if the error
 persist on the generic implementation?
-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/7720#comment:1>
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