wsd: correctly set termination and shutdown flag
We should always set the shutdown flag first. Otherwise, we run afoul of a race condition. Change-Id: Ic99793d68b3b943496ff932b4bdafd336fef7f82 Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
This commit is contained in:
parent
c5e533f943
commit
4bf085f195
1 changed files with 7 additions and 2 deletions
|
@ -65,11 +65,16 @@ namespace SigUtil
|
|||
|
||||
void setTerminationFlag()
|
||||
{
|
||||
#if !MOBILEAPP
|
||||
// Request shutting down first. Otherwise, we can race with
|
||||
// getTerminationFlag, which asserts ShutdownRequestFlag.
|
||||
ShutdownRequestFlag = true;
|
||||
#endif
|
||||
// Set the forced-termination flag.
|
||||
TerminationFlag = true;
|
||||
#if !MOBILEAPP
|
||||
// And request shutting down and wake-up the thread.
|
||||
requestShutdown();
|
||||
// And wake-up the thread.
|
||||
SocketPoll::wakeupWorld();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue