X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a8ee71c7023df4a96b862c425552e1305d1300d5..3f8e5072f7391db2158f44c6b9209bbb3db6eb06:/src/msw/thread.cpp diff --git a/src/msw/thread.cpp b/src/msw/thread.cpp index aadfc9f070..27b948f785 100644 --- a/src/msw/thread.cpp +++ b/src/msw/thread.cpp @@ -26,7 +26,7 @@ #endif #ifndef WX_PRECOMP - #include "wx/wx.h" +# include "wx/wx.h" #endif #if wxUSE_THREADS @@ -36,12 +36,29 @@ #include "wx/module.h" #include "wx/thread.h" +#ifdef Yield +# undef Yield +#endif + // must have this symbol defined to get _beginthread/_endthread declarations #ifndef _MT #define _MT #endif -#ifdef __VISUALC__ +#if defined(__VISUALC__) || \ + (defined(__BORLANDC__) && (__BORLANDC__ >= 0x500)) || \ + (defined(__GNUG__) && defined(__MSVCRT__)) + +#if defined(__BORLANDC__) && !defined(__MT__) +// I can't set -tWM in the IDE (anyone?) so have to do this +#define __MT__ +#endif + +#if defined(__BORLANDC__) && !defined(__MFC_COMPAT__) +// Needed to know about _beginthreadex etc.. +#define __MFC_COMPAT__ +#endif + #include #endif @@ -442,7 +459,9 @@ bool wxThreadInternal::Create(wxThread *thread) // for compilers which have it, we should use C RTL function for thread // creation instead of Win32 API one because otherwise we will have memory // leaks if the thread uses C RTL (and most threads do) -#ifdef __VISUALC__ +#if defined(__VISUALC__) || \ + (defined(__BORLANDC__) && (__BORLANDC__ >= 0x500)) || \ + (defined(__GNUG__) && defined(__MSVCRT__)) typedef unsigned (__stdcall *RtlThreadStart)(void *); m_hThread = (HANDLE)_beginthreadex(NULL, 0, @@ -450,7 +469,7 @@ bool wxThreadInternal::Create(wxThread *thread) wxThreadInternal::WinThreadStart, thread, CREATE_SUSPENDED, (unsigned int *)&m_tid); -#else // !VC++ +#else // compiler doesn't have _beginthreadex m_hThread = ::CreateThread ( NULL, // default security @@ -461,7 +480,7 @@ bool wxThreadInternal::Create(wxThread *thread) CREATE_SUSPENDED, // flags &m_tid // [out] thread id ); -#endif // VC++/!VC++ +#endif // _beginthreadex/CreateThread if ( m_hThread == NULL ) { @@ -912,7 +931,9 @@ void wxThread::Exit(ExitCode status) delete this; } -#ifdef __VISUALC__ +#if defined(__VISUALC__) || \ + (defined(__BORLANDC__) && (__BORLANDC__ >= 0x500)) || \ + (defined(__GNUG__) && defined(__MSVCRT__)) _endthreadex((unsigned)status); #else // !VC++ ::ExitThread((DWORD)status);