Replaced method name `run' with `mainLoop', and `stop' and `quit'

with `exitMainLoop' in most places.
This commit is contained in:
crs 2002-07-30 15:17:44 +00:00
parent 8913acac34
commit 9792d35a6b
26 changed files with 90 additions and 90 deletions

View File

@ -54,9 +54,9 @@ CClient::setAddress(const CNetworkAddress& serverAddress)
} }
void void
CClient::quit() CClient::exitMainLoop()
{ {
m_screen->stop(); m_screen->exitMainLoop();
} }
bool bool
@ -133,7 +133,7 @@ CClient::open()
} }
void void
CClient::run() CClient::mainLoop()
{ {
{ {
CLock lock(&m_mutex); CLock lock(&m_mutex);
@ -157,7 +157,7 @@ CClient::run()
} }
// handle events // handle events
m_screen->run(); m_screen->mainLoop();
// clean up // clean up
deleteSession(); deleteSession();
@ -430,11 +430,11 @@ CClient::runSession(void*)
try { try {
log((CLOG_DEBUG "starting server proxy")); log((CLOG_DEBUG "starting server proxy"));
runServer(); runServer();
m_screen->stop(); m_screen->exitMainLoop();
log((CLOG_DEBUG "stopping server proxy")); log((CLOG_DEBUG "stopping server proxy"));
} }
catch (...) { catch (...) {
m_screen->stop(); m_screen->exitMainLoop();
log((CLOG_DEBUG "stopping server proxy")); log((CLOG_DEBUG "stopping server proxy"));
throw; throw;
} }
@ -521,7 +521,7 @@ CClient::runServer()
bool rejected = true; bool rejected = true;
if (proxy != NULL) { if (proxy != NULL) {
log((CLOG_DEBUG1 "communicating with server")); log((CLOG_DEBUG1 "communicating with server"));
rejected = !proxy->run(); rejected = !proxy->mainLoop();
} }
// clean up // clean up

View File

@ -34,7 +34,7 @@ public:
Turns camping on or off. When camping the client will keep Turns camping on or off. When camping the client will keep
trying to connect to the server until it succeeds. This trying to connect to the server until it succeeds. This
is useful if the client may start before the server. Do 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); void camp(bool on);
@ -46,11 +46,11 @@ public:
//! Exit event loop //! Exit event loop
/*! /*!
Force run() to return. This call can return before Force mainLoop() to return. This call can return before
run() does (i.e. asynchronously). This may only be mainLoop() does (i.e. asynchronously). This may only be
called between a successful open() and close(). called between a successful open() and close().
*/ */
void quit(); void exitMainLoop();
//@} //@}
//! @name accessors //! @name accessors
@ -72,7 +72,7 @@ public:
// IClient overrides // IClient overrides
virtual bool open(); virtual bool open();
virtual void run(); virtual void mainLoop();
virtual void close(); virtual void close();
virtual void enter(SInt32 xAbs, SInt32 yAbs, virtual void enter(SInt32 xAbs, SInt32 yAbs,
UInt32 seqNum, KeyModifierMask mask, UInt32 seqNum, KeyModifierMask mask,

View File

@ -258,7 +258,7 @@ CMSWindowsSecondaryScreen::preDestroyWindow(HWND)
} }
void void
CMSWindowsSecondaryScreen::onPreRun() CMSWindowsSecondaryScreen::onPreMainLoop()
{ {
assert(m_window != NULL); assert(m_window != NULL);
} }

View File

@ -43,7 +43,7 @@ public:
protected: protected:
// CSecondaryScreen overrides // CSecondaryScreen overrides
virtual void onPreRun(); virtual void onPreMainLoop();
virtual void onPreOpen(); virtual void onPreOpen();
virtual void onPreEnter(); virtual void onPreEnter();
virtual void onPreLeave(); virtual void onPreLeave();

View File

@ -19,7 +19,7 @@ CSecondaryScreen::~CSecondaryScreen()
} }
void void
CSecondaryScreen::run() CSecondaryScreen::mainLoop()
{ {
// change our priority // change our priority
CThread::getCurrentThread().setPriority(-7); CThread::getCurrentThread().setPriority(-7);
@ -27,20 +27,20 @@ CSecondaryScreen::run()
// run event loop // run event loop
try { try {
log((CLOG_DEBUG "entering event loop")); log((CLOG_DEBUG "entering event loop"));
onPreRun(); onPreMainLoop();
getScreen()->mainLoop(); getScreen()->mainLoop();
onPostRun(); onPostMainLoop();
log((CLOG_DEBUG "exiting event loop")); log((CLOG_DEBUG "exiting event loop"));
} }
catch (...) { catch (...) {
onPostRun(); onPostMainLoop();
log((CLOG_DEBUG "exiting event loop")); log((CLOG_DEBUG "exiting event loop"));
throw; throw;
} }
} }
void void
CSecondaryScreen::stop() CSecondaryScreen::exitMainLoop()
{ {
getScreen()->exitMainLoop(); getScreen()->exitMainLoop();
} }
@ -200,13 +200,13 @@ CSecondaryScreen::getCursorPos(SInt32& x, SInt32& y) const
} }
void void
CSecondaryScreen::onPreRun() CSecondaryScreen::onPreMainLoop()
{ {
// do nothing // do nothing
} }
void void
CSecondaryScreen::onPostRun() CSecondaryScreen::onPostMainLoop()
{ {
// do nothing // do nothing
} }

View File

@ -37,17 +37,17 @@ public:
//! Run event loop //! Run event loop
/*! /*!
Run the screen's event loop. This returns when it detects Run the screen's event loop. This returns when it detects
the application should terminate or when stop() is called. the application should terminate or when exitMainLoop() is called.
run() may only be called between open() and close(). mainLoop() may only be called between open() and close().
*/ */
void run(); void mainLoop();
//! Exit event loop //! Exit event loop
/*! /*!
Force run() to return. This call can return before Force mainLoop() to return. This call can return before
run() does (i.e. asynchronously). mainLoop() does (i.e. asynchronously).
*/ */
void stop(); void exitMainLoop();
//! Close screen //! Close screen
/*! /*!
@ -189,19 +189,19 @@ public:
//@} //@}
protected: 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. 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. operations. Default does nothing. May \b not throw.
*/ */
virtual void onPostRun(); virtual void onPostMainLoop();
//! Pre-open() hook //! Pre-open() hook
/*! /*!

View File

@ -33,7 +33,7 @@ CServerProxy::~CServerProxy()
} }
bool bool
CServerProxy::run() CServerProxy::mainLoop()
{ {
bool failedToConnect = false; bool failedToConnect = false;
try { try {

View File

@ -36,7 +36,7 @@ public:
(cancellation point) (cancellation point)
*/ */
bool run(); bool mainLoop();
//@} //@}
//! @name accessors //! @name accessors

View File

@ -184,7 +184,7 @@ CXWindowsSecondaryScreen::getJumpZoneSize() const
} }
void void
CXWindowsSecondaryScreen::onPreRun() CXWindowsSecondaryScreen::onPreMainLoop()
{ {
assert(m_window != None); assert(m_window != None);
} }

View File

@ -39,7 +39,7 @@ public:
protected: protected:
// CSecondaryScreen overrides // CSecondaryScreen overrides
virtual void onPreRun(); virtual void onPreMainLoop();
virtual void onPreOpen(); virtual void onPreOpen();
virtual void onPostOpen(); virtual void onPostOpen();
virtual void onPreEnter(); virtual void onPreEnter();

View File

@ -95,7 +95,7 @@ realMain(CMutex* mutex)
mutex->unlock(); mutex->unlock();
} }
locked = false; locked = false;
s_client->run(); s_client->mainLoop();
locked = true; locked = true;
if (mutex != NULL) { if (mutex != NULL) {
mutex->lock(); mutex->lock();
@ -470,7 +470,7 @@ static
void void
daemonStop(void) daemonStop(void)
{ {
s_client->quit(); s_client->exitMainLoop();
} }
static static

View File

@ -44,7 +44,7 @@ public:
// IClient overrides // IClient overrides
virtual bool open() = 0; virtual bool open() = 0;
virtual void run() = 0; virtual void mainLoop() = 0;
virtual void close() = 0; virtual void close() = 0;
virtual void enter(SInt32 xAbs, SInt32 yAbs, virtual void enter(SInt32 xAbs, SInt32 yAbs,
UInt32 seqNum, KeyModifierMask mask, UInt32 seqNum, KeyModifierMask mask,

View File

@ -60,7 +60,7 @@ CClientProxy1_0::open()
} }
void void
CClientProxy1_0::run() CClientProxy1_0::mainLoop()
{ {
// handle messages until the client hangs up or stops sending heartbeats // handle messages until the client hangs up or stops sending heartbeats
CStopwatch heartTimer; CStopwatch heartTimer;

View File

@ -15,7 +15,7 @@ public:
// IClient overrides // IClient overrides
virtual bool open(); virtual bool open();
virtual void run(); virtual void mainLoop();
virtual void close(); virtual void close();
virtual void enter(SInt32 xAbs, SInt32 yAbs, virtual void enter(SInt32 xAbs, SInt32 yAbs,
UInt32 seqNum, KeyModifierMask mask, UInt32 seqNum, KeyModifierMask mask,

View File

@ -384,9 +384,9 @@ CMSWindowsPrimaryScreen::preDestroyWindow(HWND)
} }
void 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_threadID == GetCurrentThreadId());
assert(m_window != NULL); assert(m_window != NULL);
} }

View File

@ -37,7 +37,7 @@ public:
protected: protected:
// CPrimaryScreen overrides // CPrimaryScreen overrides
virtual void onPreRun(); virtual void onPreMainLoop();
virtual void onPreOpen(); virtual void onPreOpen();
virtual void onPostOpen(); virtual void onPostOpen();
virtual void onPostClose(); virtual void onPostClose();

View File

@ -40,9 +40,9 @@ CPrimaryClient::~CPrimaryClient()
} }
void void
CPrimaryClient::stop() CPrimaryClient::exitMainLoop()
{ {
m_screen->stop(); m_screen->exitMainLoop();
} }
void void
@ -122,9 +122,9 @@ CPrimaryClient::open()
} }
void void
CPrimaryClient::run() CPrimaryClient::mainLoop()
{ {
m_screen->run(); m_screen->mainLoop();
} }
void void

View File

@ -29,11 +29,11 @@ public:
//! Exit event loop //! Exit event loop
/*! /*!
Force run() to return. This call can return before Force mainLoop() to return. This call can return before
run() does (i.e. asynchronously). This may only be mainLoop() does (i.e. asynchronously). This may only be
called between a successful open() and close(). called between a successful open() and close().
*/ */
void stop(); void exitMainLoop();
//! Update configuration //! Update configuration
/*! /*!
@ -73,7 +73,7 @@ public:
// IClient overrides // IClient overrides
virtual bool open(); virtual bool open();
virtual void run(); virtual void mainLoop();
virtual void close(); virtual void close();
virtual void enter(SInt32 xAbs, SInt32 yAbs, virtual void enter(SInt32 xAbs, SInt32 yAbs,
UInt32 seqNum, KeyModifierMask mask, UInt32 seqNum, KeyModifierMask mask,

View File

@ -23,7 +23,7 @@ CPrimaryScreen::~CPrimaryScreen()
} }
void void
CPrimaryScreen::run() CPrimaryScreen::mainLoop()
{ {
// change our priority // change our priority
CThread::getCurrentThread().setPriority(-3); CThread::getCurrentThread().setPriority(-3);
@ -31,20 +31,20 @@ CPrimaryScreen::run()
// run event loop // run event loop
try { try {
log((CLOG_DEBUG "entering event loop")); log((CLOG_DEBUG "entering event loop"));
onPreRun(); onPreMainLoop();
getScreen()->mainLoop(); getScreen()->mainLoop();
onPostRun(); onPostMainLoop();
log((CLOG_DEBUG "exiting event loop")); log((CLOG_DEBUG "exiting event loop"));
} }
catch (...) { catch (...) {
onPostRun(); onPostMainLoop();
log((CLOG_DEBUG "exiting event loop")); log((CLOG_DEBUG "exiting event loop"));
throw; throw;
} }
} }
void void
CPrimaryScreen::stop() CPrimaryScreen::exitMainLoop()
{ {
getScreen()->exitMainLoop(); getScreen()->exitMainLoop();
} }
@ -198,13 +198,13 @@ CPrimaryScreen::getClipboard(ClipboardID id,
} }
void void
CPrimaryScreen::onPreRun() CPrimaryScreen::onPreMainLoop()
{ {
// do nothing // do nothing
} }
void void
CPrimaryScreen::onPostRun() CPrimaryScreen::onPostMainLoop()
{ {
// do nothing // do nothing
} }

View File

@ -37,17 +37,17 @@ public:
//! Run event loop //! Run event loop
/*! /*!
Run the screen's event loop. This returns when it detects Run the screen's event loop. This returns when it detects
the application should terminate or when stop() is called. the application should terminate or when exitMainLoop() is called.
run() may only be called between open() and close(). mainLoop() may only be called between open() and close().
*/ */
void run(); void mainLoop();
//! Exit event loop //! Exit event loop
/*! /*!
Force run() to return. This call can return before Force mainLoop() to return. This call can return before
run() does (i.e. asynchronously). mainLoop() does (i.e. asynchronously).
*/ */
void stop(); void exitMainLoop();
//! Close screen //! Close screen
/*! /*!
@ -152,19 +152,19 @@ public:
//@} //@}
protected: 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. 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. operations. Default does nothing. May \b not throw.
*/ */
virtual void onPostRun(); virtual void onPostMainLoop();
//! Pre-open() hook //! Pre-open() hook
/*! /*!

View File

@ -70,7 +70,7 @@ CServer::open()
} }
void void
CServer::run() CServer::mainLoop()
{ {
// check preconditions // check preconditions
{ {
@ -94,7 +94,7 @@ CServer::run()
} }
// handle events // handle events
m_primaryClient->run(); m_primaryClient->mainLoop();
// clean up // clean up
log((CLOG_NOTE "stopping server")); log((CLOG_NOTE "stopping server"));
@ -137,9 +137,9 @@ CServer::run()
} }
void void
CServer::quit() CServer::exitMainLoop()
{ {
m_primaryClient->stop(); m_primaryClient->exitMainLoop();
} }
void void
@ -1167,7 +1167,7 @@ CServer::acceptClients(void*)
catch (XBase& e) { catch (XBase& e) {
log((CLOG_ERR "cannot listen for clients: %s", e.what())); log((CLOG_ERR "cannot listen for clients: %s", e.what()));
delete listen; delete listen;
quit(); exitMainLoop();
} }
catch (...) { catch (...) {
delete listen; delete listen;
@ -1238,7 +1238,7 @@ CServer::runClient(void* vsocket)
// handle client messages // handle client messages
try { try {
log((CLOG_NOTE "client \"%s\" has connected", proxy->getName().c_str())); log((CLOG_NOTE "client \"%s\" has connected", proxy->getName().c_str()));
proxy->run(); proxy->mainLoop();
} }
catch (XBadClient&) { catch (XBadClient&) {
// client not behaving // client not behaving
@ -1252,7 +1252,7 @@ CServer::runClient(void* vsocket)
// FIXME -- could print network address if socket had suitable method // FIXME -- could print network address if socket had suitable method
} }
catch (...) { catch (...) {
// run() was probably cancelled // mainLoop() was probably cancelled
removeConnection(proxy->getName()); removeConnection(proxy->getName());
delete socket; delete socket;
throw; throw;
@ -1463,7 +1463,7 @@ CServer::acceptHTTPClients(void*)
log((CLOG_ERR "cannot listen for HTTP clients: %s", e.what())); log((CLOG_ERR "cannot listen for HTTP clients: %s", e.what()));
delete listen; delete listen;
// FIXME -- quit? // FIXME -- quit?
quit(); exitMainLoop();
} }
catch (...) { catch (...) {
delete listen; delete listen;

View File

@ -44,20 +44,20 @@ public:
//! Server main loop //! 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(). This must be called between a successful open() and close().
(cancellation point) (cancellation point)
*/ */
void run(); void mainLoop();
//! Exit event loop //! Exit event loop
/*! /*!
Force run() to return. This call can return before Force mainLoop() to return. This call can return before
run() does (i.e. asynchronously). This may only be mainLoop() does (i.e. asynchronously). This may only be
called between a successful open() and close(). called between a successful open() and close().
*/ */
void quit(); void exitMainLoop();
//! Close server //! Close server
/*! /*!

View File

@ -332,7 +332,7 @@ CXWindowsPrimaryScreen::getJumpZoneSize() const
} }
void void
CXWindowsPrimaryScreen::onPreRun() CXWindowsPrimaryScreen::onPreMainLoop()
{ {
assert(m_window != None); assert(m_window != None);
} }

View File

@ -36,7 +36,7 @@ public:
protected: protected:
// CPrimaryScreen overrides // CPrimaryScreen overrides
virtual void onPreRun(); virtual void onPreMainLoop();
virtual void onPreOpen(); virtual void onPreOpen();
virtual void onPostOpen(); virtual void onPostOpen();
virtual void onPreEnter(); virtual void onPreEnter();

View File

@ -125,7 +125,7 @@ realMain(CMutex* mutex)
mutex->unlock(); mutex->unlock();
} }
locked = false; locked = false;
s_server->run(); s_server->mainLoop();
locked = true; locked = true;
if (mutex != NULL) { if (mutex != NULL) {
mutex->lock(); mutex->lock();
@ -568,7 +568,7 @@ static
void void
daemonStop(void) daemonStop(void)
{ {
s_server->quit(); s_server->exitMainLoop();
} }
static static

View File

@ -31,7 +31,7 @@ public:
(cancellation point) (cancellation point)
*/ */
virtual void run() = 0; virtual void mainLoop() = 0;
//! Close client //! Close client
/*! /*!