diff options
author | kwolekr <kwolekr@minetest.net> | 2015-10-17 22:42:48 -0400 |
---|---|---|
committer | kwolekr <kwolekr@minetest.net> | 2015-10-24 02:31:23 -0400 |
commit | 964be640cb1072b122e5047ddfed19907c6b9dab (patch) | |
tree | 4e400e2774d999b5457ed8031274199958401bf7 /src/threading/thread.h | |
parent | 59fa117d13ba881f6f5e77c94f5a4ce6adb9647f (diff) | |
download | minetest-964be640cb1072b122e5047ddfed19907c6b9dab.tar.gz minetest-964be640cb1072b122e5047ddfed19907c6b9dab.tar.bz2 minetest-964be640cb1072b122e5047ddfed19907c6b9dab.zip |
Fix some threading things and add additional thread unittests
- Fix thread name reset on start()
- Fully reset thread state on kill()
- Add unittests to check for correct object states under various circumstances
Diffstat (limited to 'src/threading/thread.h')
-rw-r--r-- | src/threading/thread.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/threading/thread.h b/src/threading/thread.h index cd46856e9..3d85e0eb9 100644 --- a/src/threading/thread.h +++ b/src/threading/thread.h @@ -81,9 +81,10 @@ public: /* * Waits for thread to finish. * Note: This does not stop a thread, you have to do this on your own. - * Returns immediately if the thread is not started. + * Returns false immediately if the thread is not started or has been waited + * on before. */ - void wait(); + bool wait(); /* * Returns true if the calling thread is this Thread object. @@ -140,15 +141,14 @@ protected: private: void *m_retval; + bool m_joinable; Atomic<bool> m_request_stop; Atomic<bool> m_running; - Mutex m_continue_mutex; + Mutex m_mutex; threadid_t m_thread_id; threadhandle_t m_thread_handle; - void cleanup(); - static ThreadStartFunc threadProc; #ifdef _AIX |