summaryrefslogtreecommitdiffstats
path: root/core/command_queue_mt.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/command_queue_mt.cpp')
-rw-r--r--core/command_queue_mt.cpp25
1 files changed, 4 insertions, 21 deletions
diff --git a/core/command_queue_mt.cpp b/core/command_queue_mt.cpp
index 85e8a847a0..ace210ca2c 100644
--- a/core/command_queue_mt.cpp
+++ b/core/command_queue_mt.cpp
@@ -33,30 +33,24 @@
#include "core/os/os.h"
void CommandQueueMT::lock() {
-
mutex.lock();
}
void CommandQueueMT::unlock() {
-
mutex.unlock();
}
void CommandQueueMT::wait_for_flush() {
-
// wait one millisecond for a flush to happen
OS::get_singleton()->delay_usec(1000);
}
CommandQueueMT::SyncSemaphore *CommandQueueMT::_alloc_sync_sem() {
-
int idx = -1;
while (true) {
-
lock();
for (int i = 0; i < SYNC_SEMAPHORES; i++) {
-
if (!sync_sems[i].in_use) {
sync_sems[i].in_use = true;
idx = i;
@@ -100,25 +94,14 @@ tryagain:
}
CommandQueueMT::CommandQueueMT(bool p_sync) {
-
- read_ptr = 0;
- write_ptr = 0;
- dealloc_ptr = 0;
- command_mem = (uint8_t *)memalloc(COMMAND_MEM_SIZE);
-
- for (int i = 0; i < SYNC_SEMAPHORES; i++) {
-
- sync_sems[i].in_use = false;
- }
- if (p_sync)
+ if (p_sync) {
sync = memnew(Semaphore);
- else
- sync = NULL;
+ }
}
CommandQueueMT::~CommandQueueMT() {
-
- if (sync)
+ if (sync) {
memdelete(sync);
+ }
memfree(command_mem);
}