Added switch delay and double-tap options to win32 and added a

tray icon to the client and server that gives status feedback to
the user and allows the user to kill the app.
This commit is contained in:
crs
2003-03-12 22:34:07 +00:00
parent f411df65fb
commit 1d17f865ea
82 changed files with 4420 additions and 396 deletions

View File

@@ -97,10 +97,16 @@ CThread::wait(double timeout) const
return ARCH->wait(m_thread, timeout);
}
bool
CThread::waitForEvent(double timeout)
CThread::EWaitResult
CThread::waitForEvent(double timeout) const
{
return ARCH->waitForEvent(timeout);
// IArchMultithread EWaitResults map directly to our EWaitResults
static const EWaitResult s_map[] = {
kEvent,
kExit,
kTimeout
};
return s_map[ARCH->waitForEvent(m_thread, timeout)];
}
void*

View File

@@ -39,6 +39,13 @@ documentation.
// note -- do not derive from this class
class CThread {
public:
//! Result of waitForEvent()
enum EWaitResult {
kEvent, //!< An event is pending
kExit, //!< Thread exited
kTimeout //!< Wait timed out
};
//! Run \c adoptedJob in a new thread
/*!
Create and start a new thread executing the \c adoptedJob. The
@@ -159,18 +166,19 @@ public:
//! Wait for an event (win32)
/*!
Wait for the message queue to contain a message for up to \c timeout
seconds. This returns immediately if any message is available
(including messages that were already in the queue during the last
call to \c GetMessage() or \c PeekMessage() or waitForEvent().
Returns true iff a message is available. This will wait forever
if \c timeout < 0.0.
Wait for the message queue to contain a message or for the thread
to exit for up to \c timeout seconds. This returns immediately if
any message is available (including messages that were already in
the queue during the last call to \c GetMessage() or
\c PeekMessage() or waitForEvent(). Returns kEvent if a message
is available, kExit if the thread exited, and kTimeout otherwise.
This will wait forever if \c timeout < 0.0.
This method is available under win32 only.
(cancellation point)
*/
static bool waitForEvent(double timeout = -1.0);
EWaitResult waitForEvent(double timeout = -1.0) const;
//! Get the exit result
/*!

View File

@@ -22,8 +22,13 @@
// CTimerThread
//
CTimerThread::CTimerThread(double timeout) : m_timeout(timeout)
CTimerThread::CTimerThread(double timeout, bool* timedOut) :
m_timeout(timeout),
m_timedOut(timedOut)
{
if (m_timedOut != NULL) {
*m_timedOut = false;
}
if (m_timeout >= 0.0) {
m_callingThread = new CThread(CThread::getCurrentThread());
m_timingThread = new CThread(new TMethodJob<CTimerThread>(
@@ -53,5 +58,8 @@ CTimerThread::timer(void*)
LOG((CLOG_DEBUG1 "timeout in %f seconds", m_timeout));
ARCH->sleep(m_timeout);
LOG((CLOG_DEBUG1 "timeout"));
if (m_timedOut != NULL) {
*m_timedOut = true;
}
m_callingThread->cancel();
}

View File

@@ -30,9 +30,11 @@ public:
/*!
Cancels the calling thread after \c timeout seconds unless destroyed
before then. If \c timeout is less than zero then it never times
out and this is a no-op.
out and this is a no-op. If \c timedOutFlag is not NULL then it's
set to false in the c'tor and to true if the timeout exipires before
it's cancelled.
*/
CTimerThread(double timeout);
CTimerThread(double timeout, bool* timedOutFlag = NULL);
//! Cancel the timer thread
~CTimerThread();
@@ -45,6 +47,7 @@ private:
private:
double m_timeout;
bool* m_timedOut;
CThread* m_callingThread;
CThread* m_timingThread;
};