1
0
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:
Pedro J. Estébanez
2021-01-27 13:41:10 +01:00
parent 4ddcdc031b
commit 8f6a636ae7
37 changed files with 99 additions and 836 deletions

View File

@@ -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);
}