summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/Thread.cpp1
-rw-r--r--test/thread_test.cpp2
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");