Skip to content

Commit

Permalink
Updated for the new 3.2 godot branch - Threading/Semaphore refactor -…
Browse files Browse the repository at this point in the history
… (f15f5b45781eb3de8e5811400f654e3e49580149).
  • Loading branch information
Relintai committed Feb 20, 2021
1 parent 7204942 commit da4e049
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions thread_pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -400,18 +400,10 @@ ThreadPool::ThreadPool() {
ThreadPoolContext *context = memnew(ThreadPoolContext);

context->running = true;
#if VERSION_MAJOR < 4
context->semaphore = Semaphore::create();
#else
context->semaphore = memnew(Semaphore);
#endif

#if VERSION_MAJOR < 4
context->thread = Thread::create(ThreadPool::_worker_thread_func, context);
#else
context->thread = memnew(Thread());
context->thread->start(ThreadPool::_worker_thread_func, context);
#endif

_threads.write[i] = context;
}
Expand All @@ -431,11 +423,7 @@ ThreadPool::~ThreadPool() {
for (int i = 0; i < _threads.size(); ++i) {
ThreadPoolContext *context = _threads.get(i);

#if VERSION_MAJOR < 4
Thread::wait_to_finish(context->thread);
#else
context->thread->wait_to_finish();
#endif

memdelete(context->thread);
memdelete(context->semaphore);
Expand Down

0 comments on commit da4e049

Please sign in to comment.