Lines Matching defs:event

19 static const char *kDefaultEventQueueName = "event looper";
27 add or remove an event or to modify an event's time. It is derived from
29 its member variables (especially the event list).
32 events at the right times. The execution of an event consists of invoking
33 its Event::Do() method. If the event's Event::IsAutoDelete() or its Do()
34 method return \c true, the event object is deleted after execution. In
35 any case the event is removed from the list before it is executed. The
36 queue is not locked while an event is executed.
38 The event list (\a fEvents) is ordered ascendingly by time. The thread
40 event. This semaphore is released to indicate changes to the event list.
55 thread for timing out at the time when the next event has to be executed.
56 If the event list is changed by another thread and that changed the time
57 of the next event the semaphore is released (_Reschedule()).
74 /*! \brief Creates a new event queue.
117 while (Event *event = (Event*)fEvents.RemoveItem((int32)0)) {
118 if (event->IsAutoDelete())
119 delete event;
124 /*! \brief Returns the initialization status of the event queue.
136 If an event is currently executed, it is allowed to finish its task
152 /*! \brief Adds a new event to the queue.
154 The event's time must be set, before adding it. Afterwards ModifyEvent()
155 must be used to change an event's time.
157 If the event's time is already passed, it is executed as soon as possible.
159 \param event The event to be added.
160 \return \c true, if the event has been added successfully, \c false, if
164 EventQueue::AddEvent(Event *event)
167 bool result = (event && _AddEvent(event));
175 /*! \brief Removes an event from the queue.
176 \param event The event to be removed.
177 \return \c true, if the event has been removed successfully, \c false, if
178 the supplied event wasn't in the queue before.
181 EventQueue::RemoveEvent(Event *event)
185 if (event && ((result = _RemoveEvent(event))))
192 /*! \brief Modifies an event's time.
194 The event must be in the queue.
196 If the event's new time is already passed, it is executed as soon as
199 \param event The event in question.
200 \param newTime The new event time.
203 EventQueue::ModifyEvent(Event *event, bigtime_t newTime)
206 if (fEvents.RemoveItem(event)) {
207 event->SetTime(newTime);
208 _AddEvent(event);
215 /*! \brief Adds an event to the event list.
219 \param event The event to be added.
220 \return \c true, if the event has been added successfully, \c false, if
224 EventQueue::_AddEvent(Event *event)
226 int32 index = _FindInsertionIndex(event->Time());
227 return fEvents.AddItem(event, index);
231 /*! \brief Removes an event from the event list.
235 \param event The event to be removed.
236 \return \c true, if the event has been removed successfully, \c false, if
237 the supplied event wasn't in the queue before.
240 EventQueue::_RemoveEvent(Event *event)
242 int32 index = _IndexOfEvent(event);
247 /*! \brief Returns an event from the event list.
251 \param index The list index of the event to be returned.
252 \return The event, or \c NULL, if the index is out of range.
261 /*! \brief Returns the event list index of the supplied event.
265 \param event The event to be found.
266 \return The event list index of the supplied event or \c -1, if the event
267 is not in the event list.
270 EventQueue::_IndexOfEvent(Event *event) const
272 bigtime_t time = event->Time();
274 // The found index is the index succeeding the one of the last event with
276 // search backwards for the event
279 if (listEvent == event)
286 /*! \brief Finds the event list index at which an event with the supplied
295 \param time The event time.
296 \return The index at which an event with the supplied time should be added.
350 Event *event = (Event*)fEvents.RemoveItem((int32)0);
352 bool autoDeleteEvent = event->IsAutoDelete();
353 bool deleteEvent = event->Do(this) || autoDeleteEvent;
355 delete event;
372 /*! \brief To be called, when an event has been added or removed.
375 needs to wake up to execute the next event, and signals the thread to