From 5fdeb8515740f97150bc2f6d38c4daad1ba706c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Wed, 15 Nov 2017 09:27:29 -0800 Subject: [PATCH] Lazy init default thread allocator. --- src/thread.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/thread.cpp b/src/thread.cpp index 09a5f76..fe7f349 100644 --- a/src/thread.cpp +++ b/src/thread.cpp @@ -36,7 +36,11 @@ using namespace Windows::System::Threading; namespace bx { - static DefaultAllocator s_allocator; + static AllocatorI* getAllocator() + { + static DefaultAllocator s_allocator; + return &s_allocator; + } struct ThreadInternal { @@ -78,7 +82,7 @@ namespace bx Thread::Thread() : m_fn(NULL) , m_userData(NULL) - , m_queue(&s_allocator) + , m_queue(getAllocator() ) , m_stackSize(0) , m_exitCode(kExitSuccess) , m_running(false)