corrected wake up code

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36175 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2005-11-14 20:24:16 +00:00
parent 4b764db379
commit 41ab357ed9

View File

@@ -735,8 +735,10 @@ void wxMacWakeUp()
if ( isSame ) if ( isSame )
{ {
#if TARGET_CARBON #if TARGET_CARBON
static wxMacCarbonEvent s_wakeupEvent ;
OSStatus err = noErr ; OSStatus err = noErr ;
#if 0
// lead sometimes to race conditions, although all calls used should be thread safe ...
static wxMacCarbonEvent s_wakeupEvent ;
if ( !s_wakeupEvent.IsValid() ) if ( !s_wakeupEvent.IsValid() )
{ {
err = s_wakeupEvent.Create( 'WXMC', 'WXMC', GetCurrentEventTime(), err = s_wakeupEvent.Create( 'WXMC', 'WXMC', GetCurrentEventTime(),
@@ -744,12 +746,20 @@ void wxMacWakeUp()
} }
if ( err == noErr ) if ( err == noErr )
{ {
if ( IsEventInQueue( GetMainEventQueue() , s_wakeupEvent ) ) if ( IsEventInQueue( GetMainEventQueue() , s_wakeupEvent ) )
return ; return ;
s_wakeupEvent.SetCurrentTime() ; s_wakeupEvent.SetCurrentTime() ;
err = PostEventToQueue(GetMainEventQueue(), s_wakeupEvent, err = PostEventToQueue(GetMainEventQueue(), s_wakeupEvent,
kEventPriorityHigh); kEventPriorityHigh );
} }
#else
wxMacCarbonEvent wakeupEvent ;
wakeupEvent.Create( 'WXMC', 'WXMC', GetCurrentEventTime(),
kEventAttributeNone ) ;
err = PostEventToQueue(GetMainEventQueue(), wakeupEvent,
kEventPriorityHigh );
#endif
#else #else
PostEvent( nullEvent , 0 ) ; PostEvent( nullEvent , 0 ) ;
#endif #endif