Instead of killing the ServerApps the hard way, the AppServer now quits
them if they didn't listen to B_QUIT_REQUESTED. This works much better as how it was done before. Now uses exit() instead of exit_thread() which makes sure no thread survives. Note, there still is a race condition in case an application quits immediately before shutting down the server - in that case, it doesn't participate in the fShutdownSemaphore stuff, and therefore, the app_server could quit it too early. Maybe I'll fix that one day, as well :) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13481 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
b93d2480cc
commit
c9299b3ce8
@ -560,17 +560,24 @@ AppServer::DispatchMessage(int32 code, BPrivate::PortLink &msg)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case kMsgShutdownServer:
|
case kMsgShutdownServer:
|
||||||
|
{
|
||||||
// let's kill all remaining applications
|
// let's kill all remaining applications
|
||||||
|
|
||||||
fAppListLock.Lock();
|
fAppListLock.Lock();
|
||||||
|
|
||||||
for (int32 i = 0; i < fAppList.CountItems(); i++) {
|
int32 count = fAppList.CountItems();
|
||||||
|
for (int32 i = 0; i < count; i++) {
|
||||||
ServerApp *app = (ServerApp*)fAppList.ItemAt(i);
|
ServerApp *app = (ServerApp*)fAppList.ItemAt(i);
|
||||||
|
team_id clientTeam = app->ClientTeam();
|
||||||
|
|
||||||
kill_thread(app->Thread());
|
app->Quit();
|
||||||
kill_team(app->ClientTeam());
|
kill_team(clientTeam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// wait for the last app to die
|
||||||
|
if (count > 0)
|
||||||
|
acquire_sem_etc(fShutdownSemaphore, fShutdownCount, B_RELATIVE_TIMEOUT, 250000);
|
||||||
|
|
||||||
kill_thread(fPicassoThreadID);
|
kill_thread(fPicassoThreadID);
|
||||||
|
|
||||||
fAppListLock.Unlock();
|
fAppListLock.Unlock();
|
||||||
@ -580,8 +587,9 @@ AppServer::DispatchMessage(int32 code, BPrivate::PortLink &msg)
|
|||||||
delete gFontServer;
|
delete gFontServer;
|
||||||
|
|
||||||
// we are now clear to exit
|
// we are now clear to exit
|
||||||
exit_thread(0);
|
exit(0);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
case AS_SET_SYSCURSOR_DEFAULTS:
|
case AS_SET_SYSCURSOR_DEFAULTS:
|
||||||
|
Loading…
Reference in New Issue
Block a user