From d3c7142837dc6d1d460477115fa81dc51b92a1ce Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 24 Nov 2008 02:07:30 +0000 Subject: Use lists instead of ringbuffers for event queue - remove upper limit on event queue size and related warnings on big patch load. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@1776 a436a847-0d15-0410-975c-d299462d15a1 --- src/engine/QueuedEventSource.hpp | 36 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 23 deletions(-) (limited to 'src/engine/QueuedEventSource.hpp') diff --git a/src/engine/QueuedEventSource.hpp b/src/engine/QueuedEventSource.hpp index a06de39f..69ac15fe 100644 --- a/src/engine/QueuedEventSource.hpp +++ b/src/engine/QueuedEventSource.hpp @@ -1,5 +1,5 @@ /* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard + * Copyright (C) 2008 Dave Robillard * * Ingen is free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software @@ -15,23 +15,20 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef QUEUEDEVENTSOURCE_H -#define QUEUEDEVENTSOURCE_H +#ifndef INGEN_QUEUED_EVENT_SOURCE_HPP +#define INGEN_QUEUED_EVENT_SOURCE_HPP #include #include #include "types.hpp" #include "raul/Semaphore.hpp" -#include "raul/AtomicInt.hpp" -#include "raul/SRSWQueue.hpp" #include "raul/Slave.hpp" -#include "Event.hpp" +#include "raul/List.hpp" #include "EventSource.hpp" -using Raul::AtomicInt; - namespace Ingen { +class Event; class QueuedEvent; class PostProcessor; @@ -56,34 +53,27 @@ public: void deactivate() { Slave::stop(); } void process(PostProcessor& dest, ProcessContext& context); - + /** Signal that the blocking event is finished. * When this is called preparing will resume. This MUST be called by * blocking events in their post_process() method. */ inline void unblock() { _blocking_semaphore.post(); } protected: - void push_queued(QueuedEvent* const ev); - Event* pop_earliest_queued_before(const SampleCount time); + void push_queued(QueuedEvent* const ev); - inline bool unprepared_events() { return (_prepared_back.get() != _back.get()); } + inline bool unprepared_events() { return (_prepared_back.get() != NULL); } virtual void _whipped(); ///< Prepare 1 event private: - // Note it's important which functions access which variables for thread safety - - // 2-part queue for events that require pre-processing: - AtomicInt _front; ///< Front of queue - AtomicInt _back; ///< Back of entire queue (index of back event + 1) - AtomicInt _prepared_back; ///< Back of prepared events (index of back prepared event + 1) - const size_t _size; - QueuedEvent** _events; - Raul::Semaphore _blocking_semaphore; - Raul::Semaphore _full_semaphore; + Raul::List _events; + Raul::AtomicPtr::Node> _prepared_back; + Raul::Semaphore _blocking_semaphore; }; } // namespace Ingen -#endif // QUEUEDEVENTSOURCE_H +#endif // INGEN_QUEUED_EVENT_SOURCE_HPP + -- cgit v1.2.1