mirror of
https://github.com/godotengine/godot.git
synced 2026-01-03 18:11:19 +03:00
Modernize Semaphore
- Based on C++11's `mutex` and `condition_variable` - No more need to allocate-deallocate or check for null - No pointer anymore, just a member variable - Platform-specific implementations no longer needed - Simpler for `NO_THREADS`
This commit is contained in:
@@ -250,7 +250,7 @@
|
||||
cmd->sync_sem = ss; \
|
||||
unlock(); \
|
||||
if (sync) sync->post(); \
|
||||
ss->sem->wait(); \
|
||||
ss->sem.wait(); \
|
||||
ss->in_use = false; \
|
||||
}
|
||||
|
||||
@@ -267,7 +267,7 @@
|
||||
cmd->sync_sem = ss; \
|
||||
unlock(); \
|
||||
if (sync) sync->post(); \
|
||||
ss->sem->wait(); \
|
||||
ss->sem.wait(); \
|
||||
ss->in_use = false; \
|
||||
}
|
||||
|
||||
@@ -277,7 +277,7 @@ class CommandQueueMT {
|
||||
|
||||
struct SyncSemaphore {
|
||||
|
||||
Semaphore *sem;
|
||||
Semaphore sem;
|
||||
bool in_use;
|
||||
};
|
||||
|
||||
@@ -293,7 +293,7 @@ class CommandQueueMT {
|
||||
SyncSemaphore *sync_sem;
|
||||
|
||||
virtual void post() {
|
||||
sync_sem->sem->post();
|
||||
sync_sem->sem.post();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user