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 "Lock" it throws the exception, I'm not really sure why, I've tried reading the MSDN but I dont quite 100% understand it.
(I dont want to use mutexes...)
I believe you need to add
If that fails, you might try changing the CRITICAL_SECTION _cs to mutable rather than static, but that's kind of a shot in the dark.