2002-10-09 03:59:43 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2002, Marcus Overhagen. All rights reserved.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2002-11-20 04:28:23 +03:00
|
|
|
#include "TMap.h"
|
2002-07-09 16:24:59 +04:00
|
|
|
|
|
|
|
class AppManager
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
AppManager();
|
|
|
|
~AppManager();
|
2002-11-20 04:28:23 +03:00
|
|
|
|
|
|
|
status_t RegisterAddonServer(team_id);
|
2002-07-09 16:24:59 +04:00
|
|
|
status_t RegisterTeam(team_id, BMessenger);
|
|
|
|
status_t UnregisterTeam(team_id);
|
2002-11-20 04:28:23 +03:00
|
|
|
bool HasTeam(team_id);
|
|
|
|
void StartAddonServer();
|
|
|
|
void TerminateAddonServer();
|
2003-03-16 06:52:52 +03:00
|
|
|
team_id AddonServer();
|
2002-11-20 04:28:23 +03:00
|
|
|
|
2003-05-26 01:16:53 +04:00
|
|
|
status_t SendMessage(team_id team, BMessage *msg);
|
|
|
|
|
2002-12-10 21:18:50 +03:00
|
|
|
void Dump();
|
|
|
|
|
2002-07-09 16:24:59 +04:00
|
|
|
private:
|
2002-11-20 04:28:23 +03:00
|
|
|
void CleanupTeam(team_id);
|
|
|
|
void CleanupAddonServer();
|
|
|
|
void TeamDied(team_id team);
|
|
|
|
void RestartAddonServer();
|
|
|
|
static int32 bigbrother(void *self);
|
|
|
|
void BigBrother();
|
|
|
|
|
|
|
|
private:
|
|
|
|
team_id fAddonServer;
|
|
|
|
thread_id fBigBrother;
|
|
|
|
sem_id fQuit;
|
|
|
|
|
|
|
|
struct App {
|
2002-07-09 16:24:59 +04:00
|
|
|
team_id team;
|
|
|
|
BMessenger messenger;
|
|
|
|
};
|
2002-11-20 04:28:23 +03:00
|
|
|
Map<team_id, App> * fAppMap;
|
|
|
|
BLocker *fLocker;
|
2002-07-09 16:24:59 +04:00
|
|
|
};
|