]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/thread.cpp
Found bug that skrewed up display wrt horizontal
[wxWidgets.git] / src / msw / thread.cpp
index ac600434e9e7c561be8265db2635984639c2d4ae..27b948f785ccc8d8a20034855178b895d21b5ada 100644 (file)
@@ -26,7 +26,7 @@
 #endif
 
 #ifndef WX_PRECOMP
 #endif
 
 #ifndef WX_PRECOMP
-    #include "wx/wx.h"
+#    include "wx/wx.h"
 #endif
 
 #if wxUSE_THREADS
 #endif
 
 #if wxUSE_THREADS
 #include "wx/module.h"
 #include "wx/thread.h"
 
 #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
 
 // must have this symbol defined to get _beginthread/_endthread declarations
 #ifndef _MT
     #define _MT
 #endif
 
-#if defined(__VISUALC__) || (defined(__BORLANDC__) && (__BORLANDC__ >= 0x500))
+#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
 
 #if defined(__BORLANDC__) && !defined(__MT__)
 // I can't set -tWM in the IDE (anyone?) so have to do this
@@ -53,7 +59,6 @@
 #define __MFC_COMPAT__
 #endif
 
 #define __MFC_COMPAT__
 #endif
 
-
     #include <process.h>
 #endif
 
     #include <process.h>
 #endif
 
@@ -454,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)
     // 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)
-#if defined(__VISUALC__) || (defined(__BORLANDC__) && (__BORLANDC__ >= 0x500))
+#if defined(__VISUALC__) || \
+    (defined(__BORLANDC__) && (__BORLANDC__ >= 0x500)) || \
+    (defined(__GNUG__) && defined(__MSVCRT__))
     typedef unsigned (__stdcall *RtlThreadStart)(void *);
 
     m_hThread = (HANDLE)_beginthreadex(NULL, 0,
     typedef unsigned (__stdcall *RtlThreadStart)(void *);
 
     m_hThread = (HANDLE)_beginthreadex(NULL, 0,
@@ -462,7 +469,7 @@ bool wxThreadInternal::Create(wxThread *thread)
                                        wxThreadInternal::WinThreadStart,
                                        thread, CREATE_SUSPENDED,
                                        (unsigned int *)&m_tid);
                                        wxThreadInternal::WinThreadStart,
                                        thread, CREATE_SUSPENDED,
                                        (unsigned int *)&m_tid);
-#else // !VC++
+#else // compiler doesn't have _beginthreadex
     m_hThread = ::CreateThread
                   (
                     NULL,                               // default security
     m_hThread = ::CreateThread
                   (
                     NULL,                               // default security
@@ -473,7 +480,7 @@ bool wxThreadInternal::Create(wxThread *thread)
                     CREATE_SUSPENDED,                   // flags
                     &m_tid                              // [out] thread id
                   );
                     CREATE_SUSPENDED,                   // flags
                     &m_tid                              // [out] thread id
                   );
-#endif // VC++/!VC++
+#endif // _beginthreadex/CreateThread
 
     if ( m_hThread == NULL )
     {
 
     if ( m_hThread == NULL )
     {
@@ -924,7 +931,9 @@ void wxThread::Exit(ExitCode status)
         delete this;
     }
 
         delete this;
     }
 
-#if defined(__VISUALC__) || (defined(__BORLANDC__) && (__BORLANDC__ >= 0x500))
+#if defined(__VISUALC__) || \
+    (defined(__BORLANDC__) && (__BORLANDC__ >= 0x500)) || \
+    (defined(__GNUG__) && defined(__MSVCRT__))
     _endthreadex((unsigned)status);
 #else // !VC++
     ::ExitThread((DWORD)status);
     _endthreadex((unsigned)status);
 #else // !VC++
     ::ExitThread((DWORD)status);