During an emergency cleanup, better to not indefinitely wait for

the pipe server to finish.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31241 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Enrico Forestieri 2009-08-30 16:06:51 +00:00
parent 2d09fff374
commit c29028f94c

View File

@ -502,7 +502,12 @@ void LyXComm::closeConnection()
return;
}
emergencyCleanup();
SetEvent(stopserver_);
// Wait for the pipe server to finish
WaitForSingleObject(server_thread_, INFINITE);
CloseHandle(server_thread_);
ResetEvent(stopserver_);
CloseHandle(stopserver_);
}
@ -510,8 +515,10 @@ void LyXComm::emergencyCleanup()
{
if (ready_) {
SetEvent(stopserver_);
// Wait for the pipe server to finish
WaitForSingleObject(server_thread_, INFINITE);
// Forcibly terminate the pipe server thread if it does
// not finish quickly.
if (WaitForSingleObject(server_thread_, 200) != WAIT_OBJECT_0)
TerminateThread(server_thread_, 0);
CloseHandle(server_thread_);
ResetEvent(stopserver_);
CloseHandle(stopserver_);