Replace SMXHelperThread::GetThreadId() with SMXHelperThread::IsCurrentThread().

master
Glenn Maynard 6 years ago
parent ad2e7dcb74
commit a7cb6ad51d
  1. 5
      sdk/Windows/SMXHelperThread.cpp
  2. 5
      sdk/Windows/SMXHelperThread.h
  3. 2
      sdk/Windows/SMXManager.cpp

@ -74,3 +74,8 @@ void SMX::SMXHelperThread::RunInThread(function<void()> func)
SetEvent(m_hEvent->value()); SetEvent(m_hEvent->value());
m_Lock.Unlock(); m_Lock.Unlock();
} }
bool SMX::SMXHelperThread::IsCurrentThread() const
{
return GetCurrentThreadId() == m_iThreadId;
}

@ -26,9 +26,8 @@ public:
// Call func asynchronously from the helper thread. // Call func asynchronously from the helper thread.
void RunInThread(function<void()> func); void RunInThread(function<void()> func);
// Return the Win32 thread ID, or INVALID_HANDLE_VALUE if the thread has been // Return true if this is the calling thread.
// shut down. bool IsCurrentThread() const;
DWORD GetThreadId() const { return m_iThreadId; }
private: private:
static DWORD WINAPI ThreadMainStart(void *self_); static DWORD WINAPI ThreadMainStart(void *self_);

@ -71,7 +71,7 @@ void SMX::SMXManager::Shutdown()
// Make sure we're not being called from within m_UserCallbackThread, since that'll // Make sure we're not being called from within m_UserCallbackThread, since that'll
// deadlock when we shut down m_UserCallbackThread. // 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"); throw runtime_error("SMX::SMXManager::Shutdown must not be called from an SMX callback");
// Shut down the thread we make user callbacks from. // Shut down the thread we make user callbacks from.

Loading…
Cancel
Save