system is shutting down. For the protocol between the Registrar and input_server I decided to just re-use the message constant already defined in the input server headers (SYSTEM_SHUTTING_DOWN.) The code in the input server to notify the InputServerDevices about the shutdown was pretty trivial. For the code in the Registrar I'll let some gurus review it to make sure it fits in with the rest of the code. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19289 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
aadf8a88bb
commit
499aacdd0a
|
@ -735,7 +735,11 @@ AddOnManager::HandleSystemShuttingDown(BMessage* message,
|
||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
|
|
||||||
// TODO
|
device_info *pinfo;
|
||||||
|
for (fDeviceList.Rewind(); fDeviceList.GetNext(&pinfo);) {
|
||||||
|
pinfo->device->SystemShuttingDown();
|
||||||
|
}
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -366,8 +366,6 @@ InputServer::QuitRequested()
|
||||||
if (!BApplication::QuitRequested())
|
if (!BApplication::QuitRequested())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
PostMessage(SYSTEM_SHUTTING_DOWN);
|
|
||||||
|
|
||||||
fAddOnManager->SaveState();
|
fAddOnManager->SaveState();
|
||||||
gDeviceManager.SaveState();
|
gDeviceManager.SaveState();
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
SubDir HAIKU_TOP src servers registrar ;
|
SubDir HAIKU_TOP src servers registrar ;
|
||||||
|
|
||||||
UsePrivateHeaders app ;
|
UsePrivateHeaders app ;
|
||||||
|
UsePrivateHeaders input ;
|
||||||
UsePrivateHeaders kernel ;
|
UsePrivateHeaders kernel ;
|
||||||
UsePrivateHeaders shared ;
|
UsePrivateHeaders shared ;
|
||||||
UsePrivateHeaders storage ;
|
UsePrivateHeaders storage ;
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#include "AppInfoListMessagingTargetSet.h"
|
#include "AppInfoListMessagingTargetSet.h"
|
||||||
#include "Debug.h"
|
#include "Debug.h"
|
||||||
#include "EventQueue.h"
|
#include "EventQueue.h"
|
||||||
|
#include "InputServerTypes.h"
|
||||||
#include "MessageDeliverer.h"
|
#include "MessageDeliverer.h"
|
||||||
#include "MessageEvent.h"
|
#include "MessageEvent.h"
|
||||||
#include "Registrar.h"
|
#include "Registrar.h"
|
||||||
|
@ -703,7 +704,7 @@ ShutdownProcess::Init(BMessage *request)
|
||||||
|
|
||||||
// get a list of all applications to shut down and sort them
|
// get a list of all applications to shut down and sort them
|
||||||
error = fRoster->GetShutdownApps(fUserApps, fSystemApps, fBackgroundApps,
|
error = fRoster->GetShutdownApps(fUserApps, fSystemApps, fBackgroundApps,
|
||||||
fVitalSystemApps);
|
fVitalSystemApps, fInputServer);
|
||||||
if (error != B_OK) {
|
if (error != B_OK) {
|
||||||
fRoster->RemoveWatcher(this);
|
fRoster->RemoveWatcher(this);
|
||||||
fRoster->SetShuttingDown(false);
|
fRoster->SetShuttingDown(false);
|
||||||
|
@ -1263,6 +1264,14 @@ ShutdownProcess::_WorkerDoShutdown()
|
||||||
// sync
|
// sync
|
||||||
sync();
|
sync();
|
||||||
|
|
||||||
|
// notify the input server we are shutting down
|
||||||
|
if (fInputServer.registration_time != 0) {
|
||||||
|
// The SYSTEM_SHUTTING_DOWN message is defined in InputServerTypes.h
|
||||||
|
BMessage message(SYSTEM_SHUTTING_DOWN);
|
||||||
|
SingleMessagingTargetSet target(fInputServer.port, B_PREFERRED_TOKEN);
|
||||||
|
MessageDeliverer::Default()->DeliverMessage(&message, target);
|
||||||
|
}
|
||||||
|
|
||||||
// phase 1: terminate the user apps
|
// phase 1: terminate the user apps
|
||||||
_SetPhase(USER_APP_TERMINATION_PHASE);
|
_SetPhase(USER_APP_TERMINATION_PHASE);
|
||||||
_QuitApps(fUserApps, false);
|
_QuitApps(fUserApps, false);
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
#include "AppInfoList.h"
|
#include "AppInfoList.h"
|
||||||
#include "EventMaskWatcher.h"
|
#include "EventMaskWatcher.h"
|
||||||
|
#include "RosterAppInfo.h"
|
||||||
|
|
||||||
#if __GNUC__ >= 4
|
#if __GNUC__ >= 4
|
||||||
using __gnu_cxx::hash_set;
|
using __gnu_cxx::hash_set;
|
||||||
|
@ -96,6 +97,7 @@ private:
|
||||||
AppInfoList fSystemApps;
|
AppInfoList fSystemApps;
|
||||||
AppInfoList fUserApps;
|
AppInfoList fUserApps;
|
||||||
AppInfoList fBackgroundApps;
|
AppInfoList fBackgroundApps;
|
||||||
|
RosterAppInfo fInputServer;
|
||||||
TimeoutEvent *fTimeoutEvent;
|
TimeoutEvent *fTimeoutEvent;
|
||||||
InternalEventList *fInternalEvents;
|
InternalEventList *fInternalEvents;
|
||||||
sem_id fInternalEventSemaphore;
|
sem_id fInternalEventSemaphore;
|
||||||
|
|
|
@ -1321,7 +1321,7 @@ TRoster::SetShuttingDown(bool shuttingDown)
|
||||||
*/
|
*/
|
||||||
status_t
|
status_t
|
||||||
TRoster::GetShutdownApps(AppInfoList &userApps, AppInfoList &systemApps,
|
TRoster::GetShutdownApps(AppInfoList &userApps, AppInfoList &systemApps,
|
||||||
AppInfoList &backgroundApps, hash_set<team_id> &vitalSystemApps)
|
AppInfoList &backgroundApps, hash_set<team_id> &vitalSystemApps, RosterAppInfo &inputServer)
|
||||||
{
|
{
|
||||||
BAutolock _(fLock);
|
BAutolock _(fLock);
|
||||||
|
|
||||||
|
@ -1353,8 +1353,10 @@ TRoster::GetShutdownApps(AppInfoList &userApps, AppInfoList &systemApps,
|
||||||
// input server
|
// input server
|
||||||
RosterAppInfo *info
|
RosterAppInfo *info
|
||||||
= fRegisteredApps.InfoFor("application/x-vnd.Be-input_server");
|
= fRegisteredApps.InfoFor("application/x-vnd.Be-input_server");
|
||||||
if (info)
|
if (info) {
|
||||||
|
inputServer = *info;
|
||||||
vitalSystemApps.insert(info->team);
|
vitalSystemApps.insert(info->team);
|
||||||
|
}
|
||||||
|
|
||||||
// debug server
|
// debug server
|
||||||
info = fRegisteredApps.InfoFor("application/x-vnd.haiku-debug-server");
|
info = fRegisteredApps.InfoFor("application/x-vnd.haiku-debug-server");
|
||||||
|
|
|
@ -92,7 +92,8 @@ public:
|
||||||
|
|
||||||
void SetShuttingDown(bool shuttingDown);
|
void SetShuttingDown(bool shuttingDown);
|
||||||
status_t GetShutdownApps(AppInfoList &userApps, AppInfoList &systemApps,
|
status_t GetShutdownApps(AppInfoList &userApps, AppInfoList &systemApps,
|
||||||
AppInfoList &backgroundApps, hash_set<team_id> &vitalSystemApps);
|
AppInfoList &backgroundApps, hash_set<team_id> &vitalSystemApps,
|
||||||
|
RosterAppInfo &inputServer);
|
||||||
|
|
||||||
status_t AddWatcher(Watcher *watcher);
|
status_t AddWatcher(Watcher *watcher);
|
||||||
void RemoveWatcher(Watcher *watcher);
|
void RemoveWatcher(Watcher *watcher);
|
||||||
|
|
Loading…
Reference in New Issue