diff options
author | Christian Glöckner <cgloeckner@freenet.de> | 2016-03-29 16:45:39 +0200 |
---|---|---|
committer | André Nusser <andre.nusser@googlemail.com> | 2016-03-31 17:44:25 +0200 |
commit | b663b60b70a3a7a6678e4cc2cc29d5394e2e6539 (patch) | |
tree | cdfee424061766e74bf4ecec3ad8befe8140c7a9 /src/events.cc | |
parent | 4f4ac639f9bea3fcacf439213aabd0b70c678ecb (diff) |
API Refactoring for events
Diffstat (limited to 'src/events.cc')
-rw-r--r-- | src/events.cc | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/src/events.cc b/src/events.cc index 8149c08..a7ce715 100644 --- a/src/events.cc +++ b/src/events.cc @@ -26,25 +26,26 @@ */ #include "events.h" -void EventQueue::post(Event *event, timepos_t time) +void EventQueue::post(Event* event, timepos_t time) { - MutexAutolock lock(mutex); - event->offset = time; - queue.insert(std::pair<timepos_t, Event*>(time, event)); + MutexAutolock lock(mutex); + event->offset = time; + queue.insert(std::pair<timepos_t, Event*>(time, event)); } -Event *EventQueue::take(timepos_t time) +Event* EventQueue::take(timepos_t time) { - MutexAutolock lock(mutex); - std::multimap<timepos_t, Event*>::iterator i = queue.find(time); - if(i == queue.end()) return NULL; - Event *event = i->second; - queue.erase(i); - return event; + MutexAutolock lock(mutex); + std::multimap<timepos_t, Event*>::iterator i = queue.find(time); + if(i == queue.end()) + return NULL; + Event* event = i->second; + queue.erase(i); + return event; } bool EventQueue::hasEvent(timepos_t time) { - MutexAutolock lock(mutex); - return queue.find(time) != queue.end(); + MutexAutolock lock(mutex); + return queue.find(time) != queue.end(); } |