Add AsyncEventBus::notify

This commit is contained in:
Dawid Drozd 2019-03-30 15:32:08 +01:00
parent 2edc809a74
commit aa96ba493d
2 changed files with 13 additions and 1 deletions

View File

@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.8 FATAL_ERROR)
# BUILD_SHARED_LIBS can controll build type! # BUILD_SHARED_LIBS can controll build type!
project(EventBus project(EventBus
VERSION 2.4.1 VERSION 2.5.0
LANGUAGES CXX LANGUAGES CXX
) )

View File

@ -163,6 +163,18 @@ public:
}); });
} }
/**
* Schedule and consume event. Notify all listeners with event.
*
* @param event your event struct
*/
template <typename Event>
void notify(const Event& event)
{
schedule(event);
consume(1);
}
/** /**
* Process queued events. This should be called always on same thread. * 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. * @param max maximum count of events to consume, if 0 then all available events will be consumed.