FAQ Database Discussion Community

Locking/Unlocking functions with CRITICAL_SECTION

So, when I use "EnterCriticalSection" & "LeaveCriticalSection" I throws an exception at me, this is my current setup: void printer::Unlock() { LeaveCriticalSection(&_cs); } void printer::Lock() { EnterCriticalSection(&_cs); } _cs is a CRITICAL_SECTION object created inside my class "printer" like this: class printer { private: static CRITICAL_SECTION _cs; When I call...

PHP/MySQL Critical section

I'm using PHP with PDO and InnoDB tables. I only want the code to allow one user-submitted operation to complete, the user can either cancel or complete. But in the case that the user posts both operations, I want one of the requests to fail and rollback, which isn't happening...

Is it valid to mutilayered a critical section?

For example, is this valid? CRITICAL_SECTION cs_A; CRITICAL_SECTION cs_b; ::InitializeCriticalSection( &cs_A ); ::InitializeCriticalSection( &cs_B ); ::EnterCriticalSection( &cs_A ); // First level /* do some stuff with A */ ::EnterCriticalSection( &cs_B ); // Second level /* do some stuff with A and B */ ::LeaveCriticalSection( &cs_B ); // Second level /*...