fixed compilation with CW8 (SF patch 567845) and also added alignment fillers for wxCriticalSection::m_buffer
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15898 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
1420518999
commit
dac348b9e2
@ -241,11 +241,23 @@ private:
|
||||
#elif defined(__WXMSW__)
|
||||
// we can't allocate any memory in the ctor, so use placement new -
|
||||
// unfortunately, we have to hardcode the sizeof() here because we can't
|
||||
// include windows.h from this public header
|
||||
// include windows.h from this public header and we also have to use the
|
||||
// union to force the correct (i.e. maximal) alignment
|
||||
//
|
||||
// if CRITICAL_SECTION size changes in Windows, you'll get an assert from
|
||||
// thread.cpp and will need to increase the buffer size
|
||||
char m_buffer[24];
|
||||
//
|
||||
// finally, we need this typedef instead of declaring m_buffer directly
|
||||
// because otherwise the assert mentioned above wouldn't compile with some
|
||||
// compilers (notably CodeWarrior 8)
|
||||
typedef char wxCritSectBuffer[24];
|
||||
union
|
||||
{
|
||||
unsigned long m_dummy1;
|
||||
void *m_dummy2;
|
||||
|
||||
wxCritSectBuffer m_buffer;
|
||||
};
|
||||
#else
|
||||
// nothing for OS/2
|
||||
#endif // Unix/Win32/OS2
|
||||
|
@ -132,7 +132,7 @@ static bool gs_waitingForThread = FALSE;
|
||||
|
||||
wxCriticalSection::wxCriticalSection()
|
||||
{
|
||||
wxCOMPILE_TIME_ASSERT( sizeof(CRITICAL_SECTION) <= sizeof(m_buffer),
|
||||
wxCOMPILE_TIME_ASSERT( sizeof(CRITICAL_SECTION) <= sizeof(wxCritSectBuffer),
|
||||
wxCriticalSectionBufferTooSmall );
|
||||
|
||||
::InitializeCriticalSection((CRITICAL_SECTION *)m_buffer);
|
||||
|
Loading…
Reference in New Issue
Block a user