added some hacky sleeps to temporarily fix some thread timing issues (causing access violations). the best fix would be to use wait cond vars, but first we need to really understand the bug.
This commit is contained in:
parent
6f982a501a
commit
760e38eeba
|
@ -26,9 +26,14 @@ COSXDragView* g_dragView = NULL;
|
|||
void
|
||||
runCocoaApp()
|
||||
{
|
||||
// HACK: sleep, carbon loop should start first.
|
||||
usleep(1000000);
|
||||
|
||||
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
|
||||
NSApplication* app = [[NSApplication alloc] init];
|
||||
|
||||
NSWindow* window = [[NSWindow alloc]
|
||||
initWithContentRect: NSMakeRect(0, 0, 100, 4)
|
||||
styleMask: NSBorderlessWindowMask
|
||||
|
@ -44,8 +49,10 @@ runCocoaApp()
|
|||
g_dragView = dragView;
|
||||
[window setContentView: dragView];
|
||||
|
||||
NSLog(@"starting cocoa loop");
|
||||
[app run];
|
||||
|
||||
NSLog(@"cocoa: release");
|
||||
[pool release];
|
||||
}
|
||||
|
||||
|
|
|
@ -1691,8 +1691,13 @@ COSXScreen::watchSystemPowerThread(void*)
|
|||
return;
|
||||
}
|
||||
|
||||
// start the run loop
|
||||
LOG((CLOG_DEBUG "started watchSystemPowerThread"));
|
||||
|
||||
// HACK: sleep, this seem to stop synergy from freezing.
|
||||
ARCH->sleep(1);
|
||||
|
||||
// start the run loop
|
||||
LOG((CLOG_DEBUG "starting carbon loop"));
|
||||
CFRunLoopRun();
|
||||
|
||||
// cleanup
|
||||
|
|
|
@ -387,3 +387,10 @@ CApp::handleIpcMessage(const CEvent& e, void*)
|
|||
m_events->addEvent(CEvent(CEvent::kQuit));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CApp::runEventsLoop(void*)
|
||||
{
|
||||
m_events->cacheCurrentEventQueueRef();
|
||||
m_events->loop();
|
||||
}
|
||||
|
|
|
@ -112,9 +112,11 @@ protected:
|
|||
virtual bool parseArg(const int& argc, const char* const* argv, int& i);
|
||||
void initIpcClient();
|
||||
void cleanupIpcClient();
|
||||
void runEventsLoop(void*);
|
||||
|
||||
IArchTaskBarReceiver* m_taskBarReceiver;
|
||||
bool m_suspended;
|
||||
IEventQueue* m_events;
|
||||
|
||||
private:
|
||||
CArgsBase* m_args;
|
||||
|
@ -123,7 +125,6 @@ private:
|
|||
CreateTaskBarReceiverFunc m_createTaskBarReceiver;
|
||||
ARCH_APP_UTIL m_appUtil;
|
||||
CIpcClient* m_ipcClient;
|
||||
IEventQueue* m_events;
|
||||
CSocketMultiplexer* m_socketMultiplexer;
|
||||
CString m_fileTransferSrc;
|
||||
CString m_fileTransferDes;
|
||||
|
|
|
@ -61,7 +61,6 @@
|
|||
|
||||
CClientApp::CClientApp(IEventQueue* events, CreateTaskBarReceiverFunc createTaskBarReceiver) :
|
||||
CApp(events, createTaskBarReceiver, new CArgs()),
|
||||
m_events(events),
|
||||
s_client(NULL),
|
||||
s_clientScreen(NULL)
|
||||
{
|
||||
|
@ -537,10 +536,15 @@ CClientApp::mainLoop()
|
|||
DAEMON_RUNNING(true);
|
||||
|
||||
#if defined(MAC_OS_X_VERSION_10_7)
|
||||
|
||||
CThread thread(
|
||||
new TMethodJob<CClientApp>(
|
||||
this, &CClientApp::runEventsLoop,
|
||||
NULL));
|
||||
|
||||
// HACK: sleep, allow queue to start.
|
||||
ARCH->sleep(1);
|
||||
|
||||
runCocoaApp();
|
||||
#else
|
||||
m_events->loop();
|
||||
|
@ -626,10 +630,3 @@ CClientApp::startNode()
|
|||
m_bye(kExitFailed);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CClientApp::runEventsLoop(void*)
|
||||
{
|
||||
m_events->cacheCurrentEventQueueRef();
|
||||
m_events->loop();
|
||||
}
|
||||
|
|
|
@ -87,10 +87,8 @@ public:
|
|||
|
||||
private:
|
||||
virtual bool parseArg(const int& argc, const char* const* argv, int& i);
|
||||
void runEventsLoop(void*);
|
||||
|
||||
private:
|
||||
CClient* s_client;
|
||||
CScreen* s_clientScreen;
|
||||
IEventQueue* m_events;
|
||||
};
|
||||
|
|
|
@ -63,7 +63,6 @@
|
|||
|
||||
CServerApp::CServerApp(IEventQueue* events, CreateTaskBarReceiverFunc createTaskBarReceiver) :
|
||||
CApp(events, createTaskBarReceiver, new CArgs()),
|
||||
m_events(events),
|
||||
s_server(NULL),
|
||||
s_serverState(kUninitialized),
|
||||
s_serverScreen(NULL),
|
||||
|
@ -788,10 +787,15 @@ CServerApp::mainLoop()
|
|||
DAEMON_RUNNING(true);
|
||||
|
||||
#if defined(MAC_OS_X_VERSION_10_7)
|
||||
|
||||
CThread thread(
|
||||
new TMethodJob<CServerApp>(
|
||||
this, &CServerApp::runEventsLoop,
|
||||
NULL));
|
||||
|
||||
// HACK: sleep, allow queue to start.
|
||||
ARCH->sleep(1);
|
||||
|
||||
runCocoaApp();
|
||||
#else
|
||||
m_events->loop();
|
||||
|
@ -915,10 +919,3 @@ CServerApp::startNode()
|
|||
m_bye(kExitFailed);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CServerApp::runEventsLoop(void*)
|
||||
{
|
||||
m_events->cacheCurrentEventQueueRef();
|
||||
m_events->loop();
|
||||
}
|
||||
|
|
|
@ -121,12 +121,9 @@ public:
|
|||
CClientListener* s_listener;
|
||||
CEventQueueTimer* s_timer;
|
||||
|
||||
IEventQueue* m_events;
|
||||
|
||||
private:
|
||||
virtual bool parseArg(const int& argc, const char* const* argv, int& i);
|
||||
void handleScreenSwitched(const CEvent&, void* data);
|
||||
void runEventsLoop(void*);
|
||||
};
|
||||
|
||||
// configuration file name
|
||||
|
|
Loading…
Reference in New Issue