summaryrefslogtreecommitdiff
path: root/indra/llcommon/lleventcoro.h
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2015-12-16 17:13:04 -0500
committerNat Goodspeed <nat@lindenlab.com>2015-12-16 17:13:04 -0500
commit6a062089b86c092d6227a64502c4829fc6f0c586 (patch)
treea600c7774d72905da694b32e45f72e90b8a35584 /indra/llcommon/lleventcoro.h
parentf4b6a89ab0050b7926c47f6c59e0493391d4452b (diff)
MAINT-5976: Introduce LLCoros::set_consuming(bool).
set_consuming(true) tells each postAndSuspend() call to consume the event for which it is suspending.
Diffstat (limited to 'indra/llcommon/lleventcoro.h')
-rwxr-xr-xindra/llcommon/lleventcoro.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/indra/llcommon/lleventcoro.h b/indra/llcommon/lleventcoro.h
index bcc8cdda1d..acf2ad24a4 100755
--- a/indra/llcommon/lleventcoro.h
+++ b/indra/llcommon/lleventcoro.h
@@ -32,6 +32,7 @@
#include <boost/optional.hpp>
#include <string>
#include <stdexcept>
+#include <utility> // std::pair
#include "llevents.h"
#include "llerror.h"
@@ -75,6 +76,8 @@ private:
namespace llcoro
{
+typedef std::pair<LLSD, bool*> LLSD_consumed;
+
/// This is an adapter for a signature like void LISTENER(const LLSD&), which
/// isn't a valid LLEventPump listener: such listeners should return bool.
template <typename LISTENER>
@@ -84,11 +87,13 @@ public:
VoidListener(const LISTENER& listener):
mListener(listener)
{}
+
bool operator()(const LLSD& event)
{
- mListener(event);
- // don't swallow the event, let other listeners see it
- return false;
+ bool consumed = false;
+ mListener(LLSD_consumed(event, &consumed));
+ // tell upstream LLEventPump whether listener consumed
+ return consumed;
}
private:
LISTENER mListener;