Interrupt the wait if the stopserver event is triggered.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31311 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Enrico Forestieri 2009-09-06 13:49:34 +00:00
parent 067e770bfe
commit 50423d0e7c
2 changed files with 6 additions and 6 deletions

View File

@ -319,8 +319,8 @@ bool LyXComm::pipeServer()
QCoreApplication::postEvent(this,
static_cast<QEvent *>(event));
// Wait for completion
while (pipe_[i].nbytes && !checkStopServer())
Sleep(100);
while (pipe_[i].nbytes && !checkStopServer(100))
;
pipe_[i].pending_io = false;
pipe_[i].state = READING_STATE;
continue;
@ -354,7 +354,7 @@ bool LyXComm::pipeServer()
// We get here when a reader is started
// well before a reply is ready, so delay
// a bit in order to not burden the cpu.
Sleep(100);
checkStopServer(100);
pipe_[i].pending_io = true;
continue;
}
@ -406,9 +406,9 @@ bool LyXComm::event(QEvent * e)
}
bool LyXComm::checkStopServer()
bool LyXComm::checkStopServer(DWORD timeout)
{
return WaitForSingleObject(stopserver_, 0) == WAIT_OBJECT_0;
return WaitForSingleObject(stopserver_, timeout) == WAIT_OBJECT_0;
}

View File

@ -144,7 +144,7 @@ private:
bool event(QEvent *);
/// Check whether the pipe server must be stopped
bool checkStopServer();
bool checkStopServer(DWORD timeout = 0);
/// The filename of a (in or out) pipe instance
std::string const pipeName(DWORD) const;