diff options
Diffstat (limited to 'Swiften/EventLoop/DummyEventLoop.h')
| -rw-r--r-- | Swiften/EventLoop/DummyEventLoop.h | 45 | 
1 files changed, 18 insertions, 27 deletions
diff --git a/Swiften/EventLoop/DummyEventLoop.h b/Swiften/EventLoop/DummyEventLoop.h index 0e5e06d..da2a360 100644 --- a/Swiften/EventLoop/DummyEventLoop.h +++ b/Swiften/EventLoop/DummyEventLoop.h @@ -1,38 +1,29 @@  /* - * Copyright (c) 2010 Remko Tronçon - * Licensed under the GNU General Public License v3. - * See Documentation/Licenses/GPLv3.txt for more information. + * Copyright (c) 2010-2016 Isode Limited. + * All rights reserved. + * See the COPYING file for more information.   */  #pragma once -#include <deque> +#include <atomic>  #include <Swiften/Base/API.h>  #include <Swiften/EventLoop/EventLoop.h>  namespace Swift { -	class SWIFTEN_API DummyEventLoop : public EventLoop { -		public: -			DummyEventLoop(); -			~DummyEventLoop(); - -			void processEvents() { -				while (!events_.empty()) { -					handleEvent(events_[0]); -					events_.pop_front(); -				} -			} - -			bool hasEvents() { -				return !events_.empty(); -			} - -			virtual void post(const Event& event) { -				events_.push_back(event); -			} - -		private: -			std::deque<Event> events_; -	}; +    class SWIFTEN_API DummyEventLoop : public EventLoop { +        public: +            DummyEventLoop(); +            virtual ~DummyEventLoop(); + +            void processEvents(); + +            bool hasEvents(); + +            virtual void eventPosted(); + +        private: +            std::atomic<bool> hasEvents_ = ATOMIC_VAR_INIT(false); +    };  }  | 
 Swift