diff options
Diffstat (limited to 'servers/physics_2d/physics_2d_server_wrap_mt.cpp')
-rw-r--r-- | servers/physics_2d/physics_2d_server_wrap_mt.cpp | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/servers/physics_2d/physics_2d_server_wrap_mt.cpp b/servers/physics_2d/physics_2d_server_wrap_mt.cpp index 7070902f77..76036930c6 100644 --- a/servers/physics_2d/physics_2d_server_wrap_mt.cpp +++ b/servers/physics_2d/physics_2d_server_wrap_mt.cpp @@ -40,7 +40,7 @@ void Physics2DServerWrapMT::thread_exit() { void Physics2DServerWrapMT::thread_step(real_t p_delta) { physics_2d_server->step(p_delta); - step_sem->post(); + step_sem.post(); } void Physics2DServerWrapMT::_thread_callback(void *_instance) { @@ -84,11 +84,11 @@ void Physics2DServerWrapMT::step(real_t p_step) { void Physics2DServerWrapMT::sync() { - if (step_sem) { + if (thread) { if (first_frame) first_frame = false; else - step_sem->wait(); //must not wait if a step was not issued + step_sem.wait(); //must not wait if a step was not issued } physics_2d_server->sync(); } @@ -107,11 +107,8 @@ void Physics2DServerWrapMT::init() { if (create_thread) { - step_sem = SemaphoreOld::create(); //OS::get_singleton()->release_rendering_thread(); - if (create_thread) { - thread = Thread::create(_thread_callback, this); - } + thread = Thread::create(_thread_callback, this); while (!step_thread_up) { OS::get_singleton()->delay_usec(1000); } @@ -146,9 +143,6 @@ void Physics2DServerWrapMT::finish() { space_free_cached_ids(); area_free_cached_ids(); body_free_cached_ids(); - - if (step_sem) - memdelete(step_sem); } Physics2DServerWrapMT::Physics2DServerWrapMT(Physics2DServer *p_contained, bool p_create_thread) : @@ -157,7 +151,6 @@ Physics2DServerWrapMT::Physics2DServerWrapMT(Physics2DServer *p_contained, bool physics_2d_server = p_contained; create_thread = p_create_thread; thread = NULL; - step_sem = NULL; step_pending = 0; step_thread_up = false; |