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