|
Boost Users : |
Subject: [Boost-users] boost::recursive_mutex doesn't lock ???
From: Chris (cmrchs_at_[hidden])
Date: 2010-11-02 15:33:00
Hello.
I have a question about mutexes:
Scenario 1: (OK)
int main()
{
boost::mutex io_mutex;
io_mutex.lock();
// thread will be blocked now
boost::mutex::scoped_lock lock(io_mutex);
cout << "Test" // this statement is not executed: OK
}
So far no problem, but if I use recursive_mutex instead...
Scenario 2: (NOT OK)
int main()
{
boost::recursive_mutex io_mutex;
io_mutex.lock();
// thread will NOT be blocked ???
boost::recursive_mutex::scoped_lock lock(io_mutex);
cout << "Test" // this statement is executed ???
}
no blocking occurs??
I tried with unique_lock instead of scoped_lock but still no blocking
Why not? I don't understand.
How does one lock a recursive_mutex then?
thank you
Chris
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net