Opened 10 years ago

Last modified 6 years ago

#7720 closed Bugs

exception lock_error while intensive locking/unlocking of mutex — at Version 1

Reported by: sergey.stepanov@… Owned by: viboes
Milestone: Boost 1.60.0 Component: thread
Version: Boost 1.51.0 Severity: Regression
Keywords: lock_error Cc:

Description (last modified by viboes)

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.

Change History (1)

comment:1 by viboes, 10 years ago

Description: modified (diff)
Owner: changed from Anthony Williams to viboes
Status: newassigned

Please, could you try defining BOOST_THREAD_PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN to see if the error persist on the generic implementation?

Note: See TracTickets for help on using tickets.