void pxEvtHandler::ProcessEvent( SysExecEvent& evt ) { if( wxThread::GetCurrentId() != m_OwnerThreadId ) { SynchronousActionState sync; evt.SetSyncState( sync ); PostEvent( evt ); sync.WaitForResult(); } else evt._DoInvokeEvent(); }
bool pxEvtHandler::Rpc_TryInvoke( FnType_Void* method, const wxChar* traceName ) { if( wxThread::GetCurrentId() != m_OwnerThreadId ) { SynchronousActionState sync; SysExecEvent_MethodVoid evt(method); evt.Critical(); evt.SetSyncState( sync ); PostEvent( evt ); sync.WaitForResult(); return true; } return false; }
void pxEvtHandler::ProcessEvent( SysExecEvent* evt ) { if( !evt ) return; if( wxThread::GetCurrentId() != m_OwnerThreadId ) { SynchronousActionState sync; evt->SetSyncState( sync ); PostEvent( evt ); sync.WaitForResult(); } else { ScopedPtr<SysExecEvent> deleteMe( evt ); deleteMe->_DoInvokeEvent(); } }
int ShowModal( BaseMessageBoxEvent& evt ) { SynchronousActionState instdat; evt.SetSyncState( instdat ); if( wxThread::IsMain() ) { // main thread can handle the message immediately. wxGetApp().ProcessEvent( evt ); return instdat.return_value; } else { // Not on main thread, must post the message there for handling instead: wxGetApp().AddPendingEvent( evt ); return instdat.WaitForResult(); // Important! disable cancellation since we're using local stack vars. } }