From aa96ba493de9cd8af5545e25607ceb9baa4edc1a Mon Sep 17 00:00:00 2001 From: Dawid Drozd Date: Sat, 30 Mar 2019 15:32:08 +0100 Subject: [PATCH] Add AsyncEventBus::notify --- lib/CMakeLists.txt | 2 +- lib/include/eventbus/AsyncEventBus.h | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index d65fa6d..8671ff4 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.8 FATAL_ERROR) # BUILD_SHARED_LIBS can controll build type! project(EventBus - VERSION 2.4.1 + VERSION 2.5.0 LANGUAGES CXX ) diff --git a/lib/include/eventbus/AsyncEventBus.h b/lib/include/eventbus/AsyncEventBus.h index 37ae4c7..a4eb862 100644 --- a/lib/include/eventbus/AsyncEventBus.h +++ b/lib/include/eventbus/AsyncEventBus.h @@ -163,6 +163,18 @@ public: }); } + /** + * Schedule and consume event. Notify all listeners with event. + * + * @param event your event struct + */ + template + void notify(const Event& event) + { + schedule(event); + consume(1); + } + /** * Process queued events. This should be called always on same thread. * @param max maximum count of events to consume, if 0 then all available events will be consumed.