11299bfb2Sbeveloper /* 21299bfb2Sbeveloper * Copyright 2002, Marcus Overhagen. All rights reserved. 31299bfb2Sbeveloper * Distributed under the terms of the MIT License. 41299bfb2Sbeveloper */ 552a38012Sejakowatz 6*6396865dSbeveloper #include "TMap.h" 752a38012Sejakowatz 852a38012Sejakowatz class AppManager 952a38012Sejakowatz { 1052a38012Sejakowatz public: 1152a38012Sejakowatz AppManager(); 1252a38012Sejakowatz ~AppManager(); 13*6396865dSbeveloper 14*6396865dSbeveloper status_t RegisterAddonServer(team_id); 1552a38012Sejakowatz status_t RegisterTeam(team_id, BMessenger); 1652a38012Sejakowatz status_t UnregisterTeam(team_id); 17*6396865dSbeveloper bool HasTeam(team_id); 18*6396865dSbeveloper void StartAddonServer(); 19*6396865dSbeveloper void TerminateAddonServer(); 20*6396865dSbeveloper 2152a38012Sejakowatz private: 22*6396865dSbeveloper void CleanupTeam(team_id); 23*6396865dSbeveloper void CleanupAddonServer(); 24*6396865dSbeveloper void TeamDied(team_id team); 25*6396865dSbeveloper void RestartAddonServer(); 26*6396865dSbeveloper static int32 bigbrother(void *self); 27*6396865dSbeveloper void BigBrother(); 28*6396865dSbeveloper 29*6396865dSbeveloper private: 30*6396865dSbeveloper team_id fAddonServer; 31*6396865dSbeveloper thread_id fBigBrother; 32*6396865dSbeveloper sem_id fQuit; 33*6396865dSbeveloper 34*6396865dSbeveloper struct App { 3552a38012Sejakowatz team_id team; 3652a38012Sejakowatz BMessenger messenger; 3752a38012Sejakowatz }; 38*6396865dSbeveloper Map<team_id, App> * fAppMap; 39*6396865dSbeveloper BLocker *fLocker; 4052a38012Sejakowatz }; 41