11299bfb2Sbeveloper /* 21299bfb2Sbeveloper * Copyright 2002, Marcus Overhagen. All rights reserved. 31299bfb2Sbeveloper * Distributed under the terms of the MIT License. 41299bfb2Sbeveloper */ 552a38012Sejakowatz 66396865dSbeveloper #include "TMap.h" 752a38012Sejakowatz 852a38012Sejakowatz class AppManager 952a38012Sejakowatz { 1052a38012Sejakowatz public: 1152a38012Sejakowatz AppManager(); 1252a38012Sejakowatz ~AppManager(); 136396865dSbeveloper 146396865dSbeveloper status_t RegisterAddonServer(team_id); 1552a38012Sejakowatz status_t RegisterTeam(team_id, BMessenger); 1652a38012Sejakowatz status_t UnregisterTeam(team_id); 176396865dSbeveloper bool HasTeam(team_id); 186396865dSbeveloper void StartAddonServer(); 196396865dSbeveloper void TerminateAddonServer(); 2054187cc6Sbeveloper team_id AddonServer(); 216396865dSbeveloper 22*359ac306Sbeveloper status_t SendMessage(team_id team, BMessage *msg); 23*359ac306Sbeveloper 24ced4130fSbeveloper void Dump(); 25ced4130fSbeveloper 2652a38012Sejakowatz private: 276396865dSbeveloper void CleanupTeam(team_id); 286396865dSbeveloper void CleanupAddonServer(); 296396865dSbeveloper void TeamDied(team_id team); 306396865dSbeveloper void RestartAddonServer(); 316396865dSbeveloper static int32 bigbrother(void *self); 326396865dSbeveloper void BigBrother(); 336396865dSbeveloper 346396865dSbeveloper private: 356396865dSbeveloper team_id fAddonServer; 366396865dSbeveloper thread_id fBigBrother; 376396865dSbeveloper sem_id fQuit; 386396865dSbeveloper 396396865dSbeveloper struct App { 4052a38012Sejakowatz team_id team; 4152a38012Sejakowatz BMessenger messenger; 4252a38012Sejakowatz }; 436396865dSbeveloper Map<team_id, App> * fAppMap; 446396865dSbeveloper BLocker *fLocker; 4552a38012Sejakowatz }; 46