
3 Aug
2007
3 Aug
'07
1:27 a.m.
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