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:
Axel Dörfler 2005-07-06 04:57:57 +00:00
parent b93d2480cc
commit c9299b3ce8

View File

@ -560,17 +560,24 @@ AppServer::DispatchMessage(int32 code, BPrivate::PortLink &msg)
break;
case kMsgShutdownServer:
{
// let's kill all remaining applications
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);
team_id clientTeam = app->ClientTeam();
kill_thread(app->Thread());
kill_team(app->ClientTeam());
app->Quit();
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);
fAppListLock.Unlock();
@ -580,8 +587,9 @@ AppServer::DispatchMessage(int32 code, BPrivate::PortLink &msg)
delete gFontServer;
// we are now clear to exit
exit_thread(0);
exit(0);
break;
}
#endif
case AS_SET_SYSCURSOR_DEFAULTS: