diff --git a/docs/changes.txt b/docs/changes.txt index fb51823f02..51a1b11a28 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -65,6 +65,7 @@ wxMSW: - Add wxEnhMetaFile::Detach() (Luca Bacci). - Add support for saving 256*256 32bpp ICOs in PNG format (Artur Wieczorek). - Keep menu item icon after removing and adding it back (Artur Wieczorek). +- Add wxThread::MSWGetHandle() (troelsk). wxOSX/Cocoa: diff --git a/include/wx/thread.h b/include/wx/thread.h index 121d9b12ba..eed295d70f 100644 --- a/include/wx/thread.h +++ b/include/wx/thread.h @@ -583,6 +583,11 @@ public: // identifies a thread inside a process wxThreadIdType GetId() const; +#ifdef __WINDOWS__ + // Get the internal OS handle + WXHANDLE MSWGetHandle() const; +#endif // __WINDOWS__ + wxThreadKind GetKind() const { return m_isDetached ? wxTHREAD_DETACHED : wxTHREAD_JOINABLE; } diff --git a/interface/wx/thread.h b/interface/wx/thread.h index fc61724a95..444b359417 100644 --- a/interface/wx/thread.h +++ b/interface/wx/thread.h @@ -1107,6 +1107,15 @@ public: */ wxThreadIdType GetId() const; + /** + Gets the native thread handle. + + This method only exists in wxMSW, use GetId() in portable code. + + @since 3.1.0 + */ + WXHANDLE MSWGetHandle() const; + /** Returns the thread kind as it was given in the ctor. diff --git a/src/msw/thread.cpp b/src/msw/thread.cpp index a2408eb518..b99c03f2d5 100644 --- a/src/msw/thread.cpp +++ b/src/msw/thread.cpp @@ -1226,6 +1226,13 @@ unsigned long wxThread::GetId() const return (unsigned long)m_internal->GetId(); } +WXHANDLE wxThread::MSWGetHandle() const +{ + wxCriticalSectionLocker lock(const_cast(m_critsect)); + + return m_internal->GetHandle(); +} + bool wxThread::IsRunning() const { wxCriticalSectionLocker lock(const_cast(m_critsect));