1/* 2 * Copyright 2002, Marcus Overhagen. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5#ifndef APP_MANAGER_H 6#define APP_MANAGER_H 7 8 9#include <map> 10 11#include <Locker.h> 12#include <Messenger.h> 13 14 15class AppManager : BLocker { 16public: 17 AppManager(); 18 ~AppManager(); 19 20 status_t RegisterTeam(team_id team, 21 const BMessenger& messenger); 22 status_t UnregisterTeam(team_id team); 23 bool HasTeam(team_id team); 24 25 team_id AddOnServerTeam(); 26 27 status_t SendMessage(team_id team, BMessage* message); 28 29 void Dump(); 30 31private: 32 void _CleanupTeam(team_id team); 33 void _TeamDied(team_id team); 34 35 static status_t _BigBrotherEntry(void* self); 36 void _BigBrother(); 37 38private: 39 typedef std::map<team_id, BMessenger> AppMap; 40 41 AppMap fMap; 42 thread_id fBigBrother; 43 sem_id fQuit; 44}; 45 46 47#endif // APP_MANAGER_H 48