xref: /haiku/src/servers/media/NotificationManager.h (revision 1e36cfc2721ef13a187c6f7354dc9cbc485e89d3)
1 /*
2  * Copyright 2002, Marcus Overhagen. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 
6 #include <MediaNode.h>
7 #include "TList.h"
8 
9 class Queue;
10 
11 struct Notification
12 {
13 	BMessenger messenger;
14 	media_node node;
15 	int32 what;
16 	team_id team;
17 };
18 
19 class NotificationManager
20 {
21 public:
22 	NotificationManager();
23 	~NotificationManager();
24 
25 	void Dump();
26 
27 	void EnqueueMessage(BMessage *msg);
28 
29 	void CleanupTeam(team_id team);
30 
31 private:
32 	void RequestNotifications(BMessage *msg);
33 	void CancelNotifications(BMessage *msg);
34 	void SendNotifications(BMessage *msg);
35 
36 	void WorkerThread();
37 	static int32 worker_thread(void *arg);
38 
39 private:
40 	Queue *		fNotificationQueue;
41 	thread_id	fNotificationThreadId;
42 	BLocker	*	fLocker;
43 	List<Notification> *fNotificationList;
44 };
45