diff --git a/sdk/Windows/SMXHelperThread.cpp b/sdk/Windows/SMXHelperThread.cpp index bf3bd85..485c405 100644 --- a/sdk/Windows/SMXHelperThread.cpp +++ b/sdk/Windows/SMXHelperThread.cpp @@ -74,3 +74,8 @@ void SMX::SMXHelperThread::RunInThread(function func) SetEvent(m_hEvent->value()); m_Lock.Unlock(); } + +bool SMX::SMXHelperThread::IsCurrentThread() const +{ + return GetCurrentThreadId() == m_iThreadId; +} diff --git a/sdk/Windows/SMXHelperThread.h b/sdk/Windows/SMXHelperThread.h index ceeffa1..18ad24d 100644 --- a/sdk/Windows/SMXHelperThread.h +++ b/sdk/Windows/SMXHelperThread.h @@ -26,9 +26,8 @@ public: // Call func asynchronously from the helper thread. void RunInThread(function func); - // Return the Win32 thread ID, or INVALID_HANDLE_VALUE if the thread has been - // shut down. - DWORD GetThreadId() const { return m_iThreadId; } + // Return true if this is the calling thread. + bool IsCurrentThread() const; private: static DWORD WINAPI ThreadMainStart(void *self_); diff --git a/sdk/Windows/SMXManager.cpp b/sdk/Windows/SMXManager.cpp index baa0593..90771de 100644 --- a/sdk/Windows/SMXManager.cpp +++ b/sdk/Windows/SMXManager.cpp @@ -71,7 +71,7 @@ void SMX::SMXManager::Shutdown() // Make sure we're not being called from within m_UserCallbackThread, since that'll // deadlock when we shut down m_UserCallbackThread. - if(m_UserCallbackThread.GetThreadId() == GetCurrentThreadId()) + if(m_UserCallbackThread.IsCurrentThread()) throw runtime_error("SMX::SMXManager::Shutdown must not be called from an SMX callback"); // Shut down the thread we make user callbacks from.