2002-10-09 03:59:43 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2002, Marcus Overhagen. All rights reserved.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
2004-08-16 00:43:01 +04:00
|
|
|
#ifndef __APP_MANAGER_H
|
|
|
|
#define __APP_MANAGER_H
|
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:
|
2004-08-16 00:43:01 +04:00
|
|
|
AppManager();
|
|
|
|
~AppManager();
|
2002-11-20 04:28:23 +03:00
|
|
|
|
2004-08-16 00:43:01 +04:00
|
|
|
status_t RegisterTeam(team_id, BMessenger);
|
|
|
|
status_t UnregisterTeam(team_id);
|
|
|
|
bool HasTeam(team_id);
|
|
|
|
|
|
|
|
team_id AddonServerTeam();
|
|
|
|
|
|
|
|
status_t SendMessage(team_id team, BMessage *msg);
|
2003-05-26 01:16:53 +04:00
|
|
|
|
2004-08-16 00:43:01 +04:00
|
|
|
void Dump();
|
2002-12-10 21:18:50 +03:00
|
|
|
|
2002-07-09 16:24:59 +04:00
|
|
|
private:
|
2004-08-16 00:43:01 +04:00
|
|
|
void CleanupTeam(team_id);
|
|
|
|
void TeamDied(team_id team);
|
2002-11-20 04:28:23 +03:00
|
|
|
static int32 bigbrother(void *self);
|
2004-08-16 00:43:01 +04:00
|
|
|
void BigBrother();
|
2002-11-20 04:28:23 +03:00
|
|
|
|
|
|
|
private:
|
|
|
|
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
|
|
|
};
|
2004-08-16 00:43:01 +04:00
|
|
|
|
|
|
|
#endif // __APP_MANAGER_H
|