mirror of
https://github.com/gelldur/EventBus.git
synced 2024-12-26 18:51:02 +08:00
Update AsyncEventBus::consume to be more "logic"
This commit is contained in:
parent
6c9ba0640c
commit
66d408926f
@ -4,6 +4,7 @@
|
||||
#include <cassert>
|
||||
#include <deque>
|
||||
#include <functional>
|
||||
#include <limits>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
@ -177,11 +178,11 @@ public:
|
||||
|
||||
/**
|
||||
* 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 max is higher than available events then only available events will be consumed.
|
||||
* @return number of consumed events
|
||||
*/
|
||||
int consume(int max = 0);
|
||||
int consume(int max = std::numeric_limits<int>::max());
|
||||
|
||||
std::size_t getQueueEventCount() const
|
||||
{
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include <eventbus/AsyncEventBus.h>
|
||||
|
||||
#include <limits>
|
||||
|
||||
namespace Dexode
|
||||
{
|
||||
|
||||
@ -20,11 +18,6 @@ std::size_t AsyncEventBus::processCommandsAndGetQueuedEventsCount()
|
||||
|
||||
int AsyncEventBus::consume(int max)
|
||||
{
|
||||
if(max == 0)
|
||||
{
|
||||
max = std::numeric_limits<int>::max();
|
||||
}
|
||||
|
||||
int consumed = 0;
|
||||
|
||||
std::function<void()> eventCommand;
|
||||
|
Loading…
x
Reference in New Issue
Block a user