summaryrefslogtreecommitdiff
path: root/tests/test_command_queue.h
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-01-31 15:24:56 +0100
committerGitHub <noreply@github.com>2021-01-31 15:24:56 +0100
commit5525cd85c60455b0bb9716bbef0ad2ad8111d752 (patch)
tree52ff0e2d3e01dd2655feff1cf88f07e10d84aad1 /tests/test_command_queue.h
parent02eb11450b4151b02db861b5029783e52e16c603 (diff)
parent99fe462452be44efa618e83ad9bbecd722ae6ecd (diff)
Merge pull request #45315 from RandomShaper/modernize_thread
Modernize Thread
Diffstat (limited to 'tests/test_command_queue.h')
-rw-r--r--tests/test_command_queue.h16
1 files changed, 6 insertions, 10 deletions
diff --git a/tests/test_command_queue.h b/tests/test_command_queue.h
index 2f0b75760d..b4fa63ad2b 100644
--- a/tests/test_command_queue.h
+++ b/tests/test_command_queue.h
@@ -122,8 +122,8 @@ public:
int message_count_to_read = 0;
bool exit_threads = false;
- Thread *reader_thread = nullptr;
- Thread *writer_thread = nullptr;
+ Thread reader_thread;
+ Thread writer_thread;
int func1_count = 0;
@@ -221,20 +221,16 @@ public:
}
void init_threads() {
- reader_thread = Thread::create(&SharedThreadState::static_reader_thread_loop, this);
- writer_thread = Thread::create(&SharedThreadState::static_writer_thread_loop, this);
+ reader_thread.start(&SharedThreadState::static_reader_thread_loop, this);
+ writer_thread.start(&SharedThreadState::static_writer_thread_loop, this);
}
void destroy_threads() {
exit_threads = true;
reader_threadwork.main_start_work();
writer_threadwork.main_start_work();
- Thread::wait_to_finish(reader_thread);
- memdelete(reader_thread);
- reader_thread = nullptr;
- Thread::wait_to_finish(writer_thread);
- memdelete(writer_thread);
- writer_thread = nullptr;
+ reader_thread.wait_to_finish();
+ writer_thread.wait_to_finish();
}
};