You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-14 13:41:12 +00: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:
@@ -113,11 +113,10 @@ CommandQueueMT::CommandQueueMT(bool p_sync) {
|
||||
|
||||
for (int i = 0; i < SYNC_SEMAPHORES; i++) {
|
||||
|
||||
sync_sems[i].sem = Semaphore::create();
|
||||
sync_sems[i].in_use = false;
|
||||
}
|
||||
if (p_sync) {
|
||||
sync = Semaphore::create();
|
||||
sync = memnew(Semaphore);
|
||||
} else {
|
||||
sync = NULL;
|
||||
}
|
||||
@@ -127,9 +126,5 @@ CommandQueueMT::~CommandQueueMT() {
|
||||
|
||||
if (sync)
|
||||
memdelete(sync);
|
||||
for (int i = 0; i < SYNC_SEMAPHORES; i++) {
|
||||
|
||||
memdelete(sync_sems[i].sem);
|
||||
}
|
||||
memfree(command_mem);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user