repository_infos: Enable automatic updates on the main Haiku repostiory.
[haiku.git] / src / apps / mediaplayer / support / EventQueue.h
blob24b0ce082e3a796ab43da330568bb5a3d2d428bd
1 /*
2 * Copyright (c) 2000-2008, Ingo Weinhold <ingo_weinhold@gmx.de>,
3 * Copyright (c) 2000-2008, Stephan Aßmus <superstippi@gmx.de>,
4 * All Rights Reserved. Distributed under the terms of the MIT license.
5 */
6 #ifndef EVENT_QUEUE_H
7 #define EVENT_QUEUE_H
10 #include <List.h>
11 #include <Locker.h>
12 #include <OS.h>
15 class Event;
18 class EventQueue : public BLocker {
19 public:
20 EventQueue();
21 virtual ~EventQueue();
23 status_t InitCheck();
25 static EventQueue* CreateDefault();
26 static void DeleteDefault();
27 static EventQueue& Default();
29 void AddEvent(Event* event);
30 bool RemoveEvent(Event* event);
31 void ChangeEvent(Event* event,
32 bigtime_t newTime);
34 private:
35 void _AddEvent(Event* event);
36 Event* _EventAt(int32 index) const;
38 static int32 _execute_events_(void *cookie);
39 int32 _ExecuteEvents();
40 void _Reschedule();
42 BList fEvents;
43 thread_id fEventExecutor;
44 sem_id fThreadControl;
45 volatile bigtime_t fNextEventTime;
46 status_t fStatus;
47 static EventQueue* fDefaultQueue;
50 #endif // EVENT_QUEUE_H