diff options
author | Pedro J. Estébanez <pedrojrulez@gmail.com> | 2024-04-23 12:01:23 +0200 |
---|---|---|
committer | Pedro J. Estébanez <pedrojrulez@gmail.com> | 2024-05-08 17:41:40 +0200 |
commit | 1589433e8fb5091961e38f027eae57de9782e8ef (patch) | |
tree | 077232efc7e346aac367121574c15d68d41a3cf2 /core | |
parent | 6f0760beb34ab8c27df11c7ce85f1e3994d0df89 (diff) | |
download | redot-engine-1589433e8fb5091961e38f027eae57de9782e8ef.tar.gz |
Apply additional fixes to servers' threading
Diffstat (limited to 'core')
-rw-r--r-- | core/templates/command_queue_mt.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/core/templates/command_queue_mt.h b/core/templates/command_queue_mt.h index 2ad5d1229d..9f9b77d9d0 100644 --- a/core/templates/command_queue_mt.h +++ b/core/templates/command_queue_mt.h @@ -388,6 +388,8 @@ class CommandQueueMT { } while (sync_head != sync_head_goal); // Can't use lower-than because of wraparound. } + void _no_op() {} + public: void lock(); void unlock(); @@ -409,10 +411,15 @@ public: _flush(); } } + void flush_all() { _flush(); } + void sync() { + push_and_sync(this, &CommandQueueMT::_no_op); + } + void wait_and_flush() { ERR_FAIL_COND(pump_task_id == WorkerThreadPool::INVALID_TASK_ID); WorkerThreadPool::get_singleton()->wait_for_task_completion(pump_task_id); @@ -420,7 +427,9 @@ public: } void set_pump_task_id(WorkerThreadPool::TaskID p_task_id) { + lock(); pump_task_id = p_task_id; + unlock(); } CommandQueueMT(); |