Boost logo

Boost Users :

From: Cheng Lian (rhythm.mail_at_[hidden])
Date: 2007-08-03 03:27:02


Hi, all

I was debugging a buggy program which could be simplified as below:

#include <boost/thread.hpp>

using namespace boost;

mutex m;

void f() {
     mutex::scoped_lock lock( m );
}

int main() {
     mutex::scoped_lock lock( m );
     f();
     return 0;
}

I think this would definitely self deadlock and the program should be
waiting forever. And my Debian Linux box proved that true. But on my XP
(with SP2) box, the program didn't dead lock and everything pass
through! Seems that on Win32 platform, the mutex is recursive? I checked
the code and only CRITICAL_SECTION related is found around the
lock/unlock lines. But I think CRITICAL_SECTION itself is not recursive.
Then why? Thanks for response.

Cheers
Cheng


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