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(); 206396865dSbeveloper 21*ced4130fSbeveloper void Dump(); 22*ced4130fSbeveloper 2352a38012Sejakowatz private: 246396865dSbeveloper void CleanupTeam(team_id); 256396865dSbeveloper void CleanupAddonServer(); 266396865dSbeveloper void TeamDied(team_id team); 276396865dSbeveloper void RestartAddonServer(); 286396865dSbeveloper static int32 bigbrother(void *self); 296396865dSbeveloper void BigBrother(); 306396865dSbeveloper 316396865dSbeveloper private: 326396865dSbeveloper team_id fAddonServer; 336396865dSbeveloper thread_id fBigBrother; 346396865dSbeveloper sem_id fQuit; 356396865dSbeveloper 366396865dSbeveloper struct App { 3752a38012Sejakowatz team_id team; 3852a38012Sejakowatz BMessenger messenger; 3952a38012Sejakowatz }; 406396865dSbeveloper Map<team_id, App> * fAppMap; 416396865dSbeveloper BLocker *fLocker; 4252a38012Sejakowatz }; 43