diff --git a/client/CClient.cpp b/client/CClient.cpp index 6efa48b0..54a28ee2 100644 --- a/client/CClient.cpp +++ b/client/CClient.cpp @@ -54,9 +54,9 @@ CClient::setAddress(const CNetworkAddress& serverAddress) } void -CClient::quit() +CClient::exitMainLoop() { - m_screen->stop(); + m_screen->exitMainLoop(); } bool @@ -133,7 +133,7 @@ CClient::open() } void -CClient::run() +CClient::mainLoop() { { CLock lock(&m_mutex); @@ -157,7 +157,7 @@ CClient::run() } // handle events - m_screen->run(); + m_screen->mainLoop(); // clean up deleteSession(); @@ -430,11 +430,11 @@ CClient::runSession(void*) try { log((CLOG_DEBUG "starting server proxy")); runServer(); - m_screen->stop(); + m_screen->exitMainLoop(); log((CLOG_DEBUG "stopping server proxy")); } catch (...) { - m_screen->stop(); + m_screen->exitMainLoop(); log((CLOG_DEBUG "stopping server proxy")); throw; } @@ -521,7 +521,7 @@ CClient::runServer() bool rejected = true; if (proxy != NULL) { log((CLOG_DEBUG1 "communicating with server")); - rejected = !proxy->run(); + rejected = !proxy->mainLoop(); } // clean up diff --git a/client/CClient.h b/client/CClient.h index 7b3925e0..e4be951f 100644 --- a/client/CClient.h +++ b/client/CClient.h @@ -34,7 +34,7 @@ public: Turns camping on or off. When camping the client will keep trying to connect to the server until it succeeds. This is useful if the client may start before the server. Do - not call this while in run(). + not call this while in mainLoop(). */ void camp(bool on); @@ -46,11 +46,11 @@ public: //! Exit event loop /*! - Force run() to return. This call can return before - run() does (i.e. asynchronously). This may only be + Force mainLoop() to return. This call can return before + mainLoop() does (i.e. asynchronously). This may only be called between a successful open() and close(). */ - void quit(); + void exitMainLoop(); //@} //! @name accessors @@ -72,7 +72,7 @@ public: // IClient overrides virtual bool open(); - virtual void run(); + virtual void mainLoop(); virtual void close(); virtual void enter(SInt32 xAbs, SInt32 yAbs, UInt32 seqNum, KeyModifierMask mask, diff --git a/client/CMSWindowsSecondaryScreen.cpp b/client/CMSWindowsSecondaryScreen.cpp index 93e8179d..21b17bac 100644 --- a/client/CMSWindowsSecondaryScreen.cpp +++ b/client/CMSWindowsSecondaryScreen.cpp @@ -258,7 +258,7 @@ CMSWindowsSecondaryScreen::preDestroyWindow(HWND) } void -CMSWindowsSecondaryScreen::onPreRun() +CMSWindowsSecondaryScreen::onPreMainLoop() { assert(m_window != NULL); } diff --git a/client/CMSWindowsSecondaryScreen.h b/client/CMSWindowsSecondaryScreen.h index 67d24694..b1d7575b 100644 --- a/client/CMSWindowsSecondaryScreen.h +++ b/client/CMSWindowsSecondaryScreen.h @@ -43,7 +43,7 @@ public: protected: // CSecondaryScreen overrides - virtual void onPreRun(); + virtual void onPreMainLoop(); virtual void onPreOpen(); virtual void onPreEnter(); virtual void onPreLeave(); diff --git a/client/CSecondaryScreen.cpp b/client/CSecondaryScreen.cpp index 9452ffae..91ea7c65 100644 --- a/client/CSecondaryScreen.cpp +++ b/client/CSecondaryScreen.cpp @@ -19,7 +19,7 @@ CSecondaryScreen::~CSecondaryScreen() } void -CSecondaryScreen::run() +CSecondaryScreen::mainLoop() { // change our priority CThread::getCurrentThread().setPriority(-7); @@ -27,20 +27,20 @@ CSecondaryScreen::run() // run event loop try { log((CLOG_DEBUG "entering event loop")); - onPreRun(); + onPreMainLoop(); getScreen()->mainLoop(); - onPostRun(); + onPostMainLoop(); log((CLOG_DEBUG "exiting event loop")); } catch (...) { - onPostRun(); + onPostMainLoop(); log((CLOG_DEBUG "exiting event loop")); throw; } } void -CSecondaryScreen::stop() +CSecondaryScreen::exitMainLoop() { getScreen()->exitMainLoop(); } @@ -200,13 +200,13 @@ CSecondaryScreen::getCursorPos(SInt32& x, SInt32& y) const } void -CSecondaryScreen::onPreRun() +CSecondaryScreen::onPreMainLoop() { // do nothing } void -CSecondaryScreen::onPostRun() +CSecondaryScreen::onPostMainLoop() { // do nothing } diff --git a/client/CSecondaryScreen.h b/client/CSecondaryScreen.h index 5c4d9fe8..1ff70a29 100644 --- a/client/CSecondaryScreen.h +++ b/client/CSecondaryScreen.h @@ -37,17 +37,17 @@ public: //! Run event loop /*! Run the screen's event loop. This returns when it detects - the application should terminate or when stop() is called. - run() may only be called between open() and close(). + the application should terminate or when exitMainLoop() is called. + mainLoop() may only be called between open() and close(). */ - void run(); + void mainLoop(); //! Exit event loop /*! - Force run() to return. This call can return before - run() does (i.e. asynchronously). + Force mainLoop() to return. This call can return before + mainLoop() does (i.e. asynchronously). */ - void stop(); + void exitMainLoop(); //! Close screen /*! @@ -189,19 +189,19 @@ public: //@} protected: - //! Pre-run() hook + //! Pre-mainLoop() hook /*! - Called on entry to run(). Override to perform platform specific + Called on entry to mainLoop(). Override to perform platform specific operations. Default does nothing. May throw. */ - virtual void onPreRun(); + virtual void onPreMainLoop(); - //! Post-run() hook + //! Post-mainLoop() hook /*! - Called on exit from run(). Override to perform platform specific + Called on exit from mainLoop(). Override to perform platform specific operations. Default does nothing. May \b not throw. */ - virtual void onPostRun(); + virtual void onPostMainLoop(); //! Pre-open() hook /*! diff --git a/client/CServerProxy.cpp b/client/CServerProxy.cpp index bec9d1ce..ce094faf 100644 --- a/client/CServerProxy.cpp +++ b/client/CServerProxy.cpp @@ -33,7 +33,7 @@ CServerProxy::~CServerProxy() } bool -CServerProxy::run() +CServerProxy::mainLoop() { bool failedToConnect = false; try { diff --git a/client/CServerProxy.h b/client/CServerProxy.h index d0eecc21..145da7f1 100644 --- a/client/CServerProxy.h +++ b/client/CServerProxy.h @@ -36,7 +36,7 @@ public: (cancellation point) */ - bool run(); + bool mainLoop(); //@} //! @name accessors diff --git a/client/CXWindowsSecondaryScreen.cpp b/client/CXWindowsSecondaryScreen.cpp index 968cf5cf..4c921927 100644 --- a/client/CXWindowsSecondaryScreen.cpp +++ b/client/CXWindowsSecondaryScreen.cpp @@ -184,7 +184,7 @@ CXWindowsSecondaryScreen::getJumpZoneSize() const } void -CXWindowsSecondaryScreen::onPreRun() +CXWindowsSecondaryScreen::onPreMainLoop() { assert(m_window != None); } diff --git a/client/CXWindowsSecondaryScreen.h b/client/CXWindowsSecondaryScreen.h index 113eb03e..30facac4 100644 --- a/client/CXWindowsSecondaryScreen.h +++ b/client/CXWindowsSecondaryScreen.h @@ -39,7 +39,7 @@ public: protected: // CSecondaryScreen overrides - virtual void onPreRun(); + virtual void onPreMainLoop(); virtual void onPreOpen(); virtual void onPostOpen(); virtual void onPreEnter(); diff --git a/client/client.cpp b/client/client.cpp index cc2243ed..a8b5b3f9 100644 --- a/client/client.cpp +++ b/client/client.cpp @@ -95,7 +95,7 @@ realMain(CMutex* mutex) mutex->unlock(); } locked = false; - s_client->run(); + s_client->mainLoop(); locked = true; if (mutex != NULL) { mutex->lock(); @@ -470,7 +470,7 @@ static void daemonStop(void) { - s_client->quit(); + s_client->exitMainLoop(); } static diff --git a/server/CClientProxy.h b/server/CClientProxy.h index 7d7c4c31..83cb3e14 100644 --- a/server/CClientProxy.h +++ b/server/CClientProxy.h @@ -44,7 +44,7 @@ public: // IClient overrides virtual bool open() = 0; - virtual void run() = 0; + virtual void mainLoop() = 0; virtual void close() = 0; virtual void enter(SInt32 xAbs, SInt32 yAbs, UInt32 seqNum, KeyModifierMask mask, diff --git a/server/CClientProxy1_0.cpp b/server/CClientProxy1_0.cpp index 4a969b93..88b8b429 100644 --- a/server/CClientProxy1_0.cpp +++ b/server/CClientProxy1_0.cpp @@ -60,7 +60,7 @@ CClientProxy1_0::open() } void -CClientProxy1_0::run() +CClientProxy1_0::mainLoop() { // handle messages until the client hangs up or stops sending heartbeats CStopwatch heartTimer; diff --git a/server/CClientProxy1_0.h b/server/CClientProxy1_0.h index 0f5679a0..befb480c 100644 --- a/server/CClientProxy1_0.h +++ b/server/CClientProxy1_0.h @@ -15,7 +15,7 @@ public: // IClient overrides virtual bool open(); - virtual void run(); + virtual void mainLoop(); virtual void close(); virtual void enter(SInt32 xAbs, SInt32 yAbs, UInt32 seqNum, KeyModifierMask mask, diff --git a/server/CMSWindowsPrimaryScreen.cpp b/server/CMSWindowsPrimaryScreen.cpp index fa78e8fb..3b257840 100644 --- a/server/CMSWindowsPrimaryScreen.cpp +++ b/server/CMSWindowsPrimaryScreen.cpp @@ -384,9 +384,9 @@ CMSWindowsPrimaryScreen::preDestroyWindow(HWND) } void -CMSWindowsPrimaryScreen::onPreRun() +CMSWindowsPrimaryScreen::onPreMainLoop() { - // must call run() from same thread as open() + // must call mainLoop() from same thread as open() assert(m_threadID == GetCurrentThreadId()); assert(m_window != NULL); } diff --git a/server/CMSWindowsPrimaryScreen.h b/server/CMSWindowsPrimaryScreen.h index 30c06f5d..aa61b492 100644 --- a/server/CMSWindowsPrimaryScreen.h +++ b/server/CMSWindowsPrimaryScreen.h @@ -37,7 +37,7 @@ public: protected: // CPrimaryScreen overrides - virtual void onPreRun(); + virtual void onPreMainLoop(); virtual void onPreOpen(); virtual void onPostOpen(); virtual void onPostClose(); diff --git a/server/CPrimaryClient.cpp b/server/CPrimaryClient.cpp index 1f53cb01..a1e3113d 100644 --- a/server/CPrimaryClient.cpp +++ b/server/CPrimaryClient.cpp @@ -40,9 +40,9 @@ CPrimaryClient::~CPrimaryClient() } void -CPrimaryClient::stop() +CPrimaryClient::exitMainLoop() { - m_screen->stop(); + m_screen->exitMainLoop(); } void @@ -122,9 +122,9 @@ CPrimaryClient::open() } void -CPrimaryClient::run() +CPrimaryClient::mainLoop() { - m_screen->run(); + m_screen->mainLoop(); } void diff --git a/server/CPrimaryClient.h b/server/CPrimaryClient.h index 468133d0..6631203e 100644 --- a/server/CPrimaryClient.h +++ b/server/CPrimaryClient.h @@ -29,11 +29,11 @@ public: //! Exit event loop /*! - Force run() to return. This call can return before - run() does (i.e. asynchronously). This may only be + Force mainLoop() to return. This call can return before + mainLoop() does (i.e. asynchronously). This may only be called between a successful open() and close(). */ - void stop(); + void exitMainLoop(); //! Update configuration /*! @@ -73,7 +73,7 @@ public: // IClient overrides virtual bool open(); - virtual void run(); + virtual void mainLoop(); virtual void close(); virtual void enter(SInt32 xAbs, SInt32 yAbs, UInt32 seqNum, KeyModifierMask mask, diff --git a/server/CPrimaryScreen.cpp b/server/CPrimaryScreen.cpp index 5c8369e0..d8f1bc9b 100644 --- a/server/CPrimaryScreen.cpp +++ b/server/CPrimaryScreen.cpp @@ -23,7 +23,7 @@ CPrimaryScreen::~CPrimaryScreen() } void -CPrimaryScreen::run() +CPrimaryScreen::mainLoop() { // change our priority CThread::getCurrentThread().setPriority(-3); @@ -31,20 +31,20 @@ CPrimaryScreen::run() // run event loop try { log((CLOG_DEBUG "entering event loop")); - onPreRun(); + onPreMainLoop(); getScreen()->mainLoop(); - onPostRun(); + onPostMainLoop(); log((CLOG_DEBUG "exiting event loop")); } catch (...) { - onPostRun(); + onPostMainLoop(); log((CLOG_DEBUG "exiting event loop")); throw; } } void -CPrimaryScreen::stop() +CPrimaryScreen::exitMainLoop() { getScreen()->exitMainLoop(); } @@ -198,13 +198,13 @@ CPrimaryScreen::getClipboard(ClipboardID id, } void -CPrimaryScreen::onPreRun() +CPrimaryScreen::onPreMainLoop() { // do nothing } void -CPrimaryScreen::onPostRun() +CPrimaryScreen::onPostMainLoop() { // do nothing } diff --git a/server/CPrimaryScreen.h b/server/CPrimaryScreen.h index 1bde5f92..772f88f9 100644 --- a/server/CPrimaryScreen.h +++ b/server/CPrimaryScreen.h @@ -37,17 +37,17 @@ public: //! Run event loop /*! Run the screen's event loop. This returns when it detects - the application should terminate or when stop() is called. - run() may only be called between open() and close(). + the application should terminate or when exitMainLoop() is called. + mainLoop() may only be called between open() and close(). */ - void run(); + void mainLoop(); //! Exit event loop /*! - Force run() to return. This call can return before - run() does (i.e. asynchronously). + Force mainLoop() to return. This call can return before + mainLoop() does (i.e. asynchronously). */ - void stop(); + void exitMainLoop(); //! Close screen /*! @@ -152,19 +152,19 @@ public: //@} protected: - //! Pre-run() hook + //! Pre-mainLoop() hook /*! - Called on entry to run(). Override to perform platform specific + Called on entry to mainLoop(). Override to perform platform specific operations. Default does nothing. May throw. */ - virtual void onPreRun(); + virtual void onPreMainLoop(); - //! Post-run() hook + //! Post-mainLoop() hook /*! - Called on exit from run(). Override to perform platform specific + Called on exit from mainLoop(). Override to perform platform specific operations. Default does nothing. May \b not throw. */ - virtual void onPostRun(); + virtual void onPostMainLoop(); //! Pre-open() hook /*! diff --git a/server/CServer.cpp b/server/CServer.cpp index 9c4f3467..a4138b1e 100644 --- a/server/CServer.cpp +++ b/server/CServer.cpp @@ -70,7 +70,7 @@ CServer::open() } void -CServer::run() +CServer::mainLoop() { // check preconditions { @@ -94,7 +94,7 @@ CServer::run() } // handle events - m_primaryClient->run(); + m_primaryClient->mainLoop(); // clean up log((CLOG_NOTE "stopping server")); @@ -137,9 +137,9 @@ CServer::run() } void -CServer::quit() +CServer::exitMainLoop() { - m_primaryClient->stop(); + m_primaryClient->exitMainLoop(); } void @@ -1167,7 +1167,7 @@ CServer::acceptClients(void*) catch (XBase& e) { log((CLOG_ERR "cannot listen for clients: %s", e.what())); delete listen; - quit(); + exitMainLoop(); } catch (...) { delete listen; @@ -1238,7 +1238,7 @@ CServer::runClient(void* vsocket) // handle client messages try { log((CLOG_NOTE "client \"%s\" has connected", proxy->getName().c_str())); - proxy->run(); + proxy->mainLoop(); } catch (XBadClient&) { // client not behaving @@ -1252,7 +1252,7 @@ CServer::runClient(void* vsocket) // FIXME -- could print network address if socket had suitable method } catch (...) { - // run() was probably cancelled + // mainLoop() was probably cancelled removeConnection(proxy->getName()); delete socket; throw; @@ -1463,7 +1463,7 @@ CServer::acceptHTTPClients(void*) log((CLOG_ERR "cannot listen for HTTP clients: %s", e.what())); delete listen; // FIXME -- quit? - quit(); + exitMainLoop(); } catch (...) { delete listen; diff --git a/server/CServer.h b/server/CServer.h index a40823fd..43d58879 100644 --- a/server/CServer.h +++ b/server/CServer.h @@ -44,20 +44,20 @@ public: //! Server main loop /*! - Run server's event loop and return when quit() is called. + Run server's event loop and return when exitMainLoop() is called. This must be called between a successful open() and close(). (cancellation point) */ - void run(); + void mainLoop(); //! Exit event loop /*! - Force run() to return. This call can return before - run() does (i.e. asynchronously). This may only be + Force mainLoop() to return. This call can return before + mainLoop() does (i.e. asynchronously). This may only be called between a successful open() and close(). */ - void quit(); + void exitMainLoop(); //! Close server /*! diff --git a/server/CXWindowsPrimaryScreen.cpp b/server/CXWindowsPrimaryScreen.cpp index ba4e8a39..e1463aee 100644 --- a/server/CXWindowsPrimaryScreen.cpp +++ b/server/CXWindowsPrimaryScreen.cpp @@ -332,7 +332,7 @@ CXWindowsPrimaryScreen::getJumpZoneSize() const } void -CXWindowsPrimaryScreen::onPreRun() +CXWindowsPrimaryScreen::onPreMainLoop() { assert(m_window != None); } diff --git a/server/CXWindowsPrimaryScreen.h b/server/CXWindowsPrimaryScreen.h index 08e244fd..b9b4ce22 100644 --- a/server/CXWindowsPrimaryScreen.h +++ b/server/CXWindowsPrimaryScreen.h @@ -36,7 +36,7 @@ public: protected: // CPrimaryScreen overrides - virtual void onPreRun(); + virtual void onPreMainLoop(); virtual void onPreOpen(); virtual void onPostOpen(); virtual void onPreEnter(); diff --git a/server/server.cpp b/server/server.cpp index c49d4a8e..0a308d34 100644 --- a/server/server.cpp +++ b/server/server.cpp @@ -125,7 +125,7 @@ realMain(CMutex* mutex) mutex->unlock(); } locked = false; - s_server->run(); + s_server->mainLoop(); locked = true; if (mutex != NULL) { mutex->lock(); @@ -568,7 +568,7 @@ static void daemonStop(void) { - s_server->quit(); + s_server->exitMainLoop(); } static diff --git a/synergy/IClient.h b/synergy/IClient.h index c93c021c..01027abb 100644 --- a/synergy/IClient.h +++ b/synergy/IClient.h @@ -31,7 +31,7 @@ public: (cancellation point) */ - virtual void run() = 0; + virtual void mainLoop() = 0; //! Close client /*!