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

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