You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-08 12:40:44 +00:00
Added missing readers writers lock to windows, should compile and run again..
This commit is contained in:
72
drivers/windows/rw_lock_windows.cpp
Normal file
72
drivers/windows/rw_lock_windows.cpp
Normal file
@@ -0,0 +1,72 @@
|
||||
|
||||
#if defined(WINDOWS_ENABLED)
|
||||
|
||||
#include "os/memory.h"
|
||||
#include "rw_lock_windows.h"
|
||||
#include "error_macros.h"
|
||||
#include <stdio.h>
|
||||
|
||||
void RWLockWindows::read_lock() {
|
||||
|
||||
AcquireSRWLockShared(&lock);
|
||||
|
||||
}
|
||||
|
||||
void RWLockWindows::read_unlock() {
|
||||
|
||||
ReleaseSRWLockShared(&lock);
|
||||
}
|
||||
|
||||
Error RWLockWindows::read_try_lock() {
|
||||
|
||||
if (TryAcquireSRWLockShared(&lock)==0) {
|
||||
return ERR_BUSY;
|
||||
} else {
|
||||
return OK;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void RWLockWindows::write_lock() {
|
||||
|
||||
AcquireSRWLockExclusive(&lock);
|
||||
|
||||
}
|
||||
|
||||
void RWLockWindows::write_unlock() {
|
||||
|
||||
ReleaseSRWLockExclusive(&lock);
|
||||
}
|
||||
|
||||
Error RWLockWindows::write_try_lock() {
|
||||
if (TryAcquireSRWLockExclusive(&lock)==0) {
|
||||
return ERR_BUSY;
|
||||
} else {
|
||||
return OK;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
RWLock *RWLockWindows::create_func_windows() {
|
||||
|
||||
return memnew( RWLockWindows );
|
||||
}
|
||||
|
||||
void RWLockWindows::make_default() {
|
||||
|
||||
create_func=create_func_windows;
|
||||
}
|
||||
|
||||
|
||||
RWLockWindows::RWLockWindows() {
|
||||
|
||||
InitializeSRWLock(&lock);
|
||||
}
|
||||
|
||||
|
||||
RWLockWindows::~RWLockWindows() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user