diff options
author | David Robillard <d@drobilla.net> | 2012-05-12 15:24:13 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-05-12 15:24:13 +0000 |
commit | 73a7dd2818c8eb2d46b2065347030691bfc8140a (patch) | |
tree | c9cdb0716a8435e726923b12627f0c59bd48f23c | |
parent | ff66c64ebad0761c726ef52b95ec4f2b41c9b853 (diff) | |
download | raul-73a7dd2818c8eb2d46b2065347030691bfc8140a.tar.gz raul-73a7dd2818c8eb2d46b2065347030691bfc8140a.tar.bz2 raul-73a7dd2818c8eb2d46b2065347030691bfc8140a.zip |
Fix Thread::get() when called before any Thread is created.
git-svn-id: http://svn.drobilla.net/lad/trunk/raul@4378 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r-- | src/Thread.cpp | 1 | ||||
-rw-r--r-- | test/thread_test.cpp | 2 |
2 files changed, 1 insertions, 2 deletions
diff --git a/src/Thread.cpp b/src/Thread.cpp index e35d347..a2d79c3 100644 --- a/src/Thread.cpp +++ b/src/Thread.cpp @@ -79,6 +79,7 @@ Thread::create_for_this_thread(const std::string& name) Thread& Thread::get() { + pthread_once(&s_thread_key_once, thread_key_alloc); Thread* this_thread = reinterpret_cast<Thread*>( pthread_getspecific(s_thread_key)); if (!this_thread) diff --git a/test/thread_test.cpp b/test/thread_test.cpp index 03dbaa9..176e544 100644 --- a/test/thread_test.cpp +++ b/test/thread_test.cpp @@ -24,8 +24,6 @@ private: int main() { - Thread::create_for_this_thread(); - Thread& this_thread = Thread::get(); this_thread.set_name("Main"); |