This commit is contained in:
Arctis-Fireblight
2025-08-27 23:18:33 -05:00
177 changed files with 1631 additions and 967 deletions

View File

@@ -37,6 +37,10 @@
#include "core/templates/command_queue_mt.h"
#include "servers/physics_server_2d.h"
#define ASYNC_COND_PUSH (Thread::get_caller_id() != server_thread)
#define ASYNC_COND_PUSH_AND_RET (Thread::get_caller_id() != server_thread && !(doing_sync.is_set() && Thread::is_main_thread()))
#define ASYNC_COND_PUSH_AND_SYNC (Thread::get_caller_id() != server_thread && !(doing_sync.is_set() && Thread::is_main_thread()))
#ifdef DEBUG_SYNC
#define SYNC_DEBUG print_line("sync on: " + String(__FUNCTION__));
#else
@@ -60,10 +64,12 @@ class PhysicsServer2DWrapMT : public PhysicsServer2D {
WorkerThreadPool::TaskID server_task_id = WorkerThreadPool::INVALID_TASK_ID;
bool exit = false;
bool create_thread = false;
SafeFlag doing_sync;
void _assign_mt_ids(WorkerThreadPool::TaskID p_pump_task_id);
void _thread_exit();
void _thread_loop();
void _thread_sync();
public:
#define ServerName PhysicsServer2D