Opened 10 years ago
Last modified 6 years ago
#7720 closed Bugs
exception lock_error while intensive locking/unlocking of mutex — at Initial Version
Reported by: | Owned by: | Anthony Williams | |
---|---|---|---|
Milestone: | Boost 1.60.0 | Component: | thread |
Version: | Boost 1.51.0 | Severity: | Regression |
Keywords: | lock_error | Cc: |
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.