switching from EnterCriticalSection to TryEnterCriticalSection
parent
99f44219bc
commit
aaae2f5705
|
@ -96,7 +96,7 @@ const MutexWindows = struct {
|
|||
|
||||
pub fn acquire(self: *Mutex) Held {
|
||||
self.initOsData();
|
||||
windows.EnterCriticalSection(&self.lock);
|
||||
while (windows.TryEnterCriticalSection(&self.lock) == 0) {}
|
||||
return Held { .mutex = self };
|
||||
}
|
||||
};
|
||||
|
|
|
@ -222,7 +222,7 @@ pub const FOREGROUND_RED = 4;
|
|||
pub const FOREGROUND_INTENSITY = 8;
|
||||
|
||||
pub extern "kernel32" stdcallcc fn InitializeCriticalSection(lpCriticalSection: *?RTL_CRITICAL_SECTION) void;
|
||||
pub extern "kernel32" stdcallcc fn EnterCriticalSection(lpCriticalSection: *?RTL_CRITICAL_SECTION) void;
|
||||
pub extern "kernel32" stdcallcc fn TryEnterCriticalSection(lpCriticalSection: *?RTL_CRITICAL_SECTION) BOOL;
|
||||
pub extern "kernel32" stdcallcc fn LeaveCriticalSection(lpCriticalSection: *?RTL_CRITICAL_SECTION) void;
|
||||
pub extern "kernel32" stdcallcc fn DeleteCriticalSection(lpCriticalSection: *?RTL_CRITICAL_SECTION) void;
|
||||
|
||||
|
|
Loading…
Reference in New Issue