xref: /haiku/src/servers/media/AppManager.h (revision 1e36cfc2721ef13a187c6f7354dc9cbc485e89d3)
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 #include "TMap.h"
9 
10 class AppManager
11 {
12 public:
13 				AppManager();
14 				~AppManager();
15 
16 	status_t	RegisterTeam(team_id, BMessenger);
17 	status_t	UnregisterTeam(team_id);
18 	bool		HasTeam(team_id);
19 
20 	team_id		AddonServerTeam();
21 
22 	status_t	SendMessage(team_id team, BMessage *msg);
23 
24 	void		Dump();
25 
26 private:
27 	void		CleanupTeam(team_id);
28 	void		TeamDied(team_id team);
29 	static int32 bigbrother(void *self);
30 	void		BigBrother();
31 
32 private:
33 	thread_id fBigBrother;
34 	sem_id fQuit;
35 
36 	struct App {
37 		team_id team;
38 		BMessenger messenger;
39 	};
40 	Map<team_id, App> * fAppMap;
41 	BLocker	*fLocker;
42 };
43 
44 #endif // __APP_MANAGER_H
45