summaryrefslogtreecommitdiff
path: root/indra/llcommon/lleventcoro.h
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2009-06-03 21:38:21 +0000
committerNat Goodspeed <nat@lindenlab.com>2009-06-03 21:38:21 +0000
commit285613b892f41d0c72c03b8551dd003f61a5f2be (patch)
tree648299cef5fac0a373e5e3ba1e244d21ba34b42a /indra/llcommon/lleventcoro.h
parent7fe359b293db531e7ff82ef606cfa4c5c826b656 (diff)
DEV-32777: Introduce LLCoros, an LLSingleton registry of named coroutine
instances. LLCoros::launch() intends to address three issues: - ownership of coroutine instance - cleanup of coroutine instance when it terminates - central place to twiddle MSVC optimizations to bypass DEV-32777 crash. Initially coded on Mac; will address the third bullet on Windows. Adapt listenerNameForCoro() to consult LLCoros::getName() if applicable. Change LLLogin::Impl::connect() to use LLCoros::launch(). LLCoros::getName() relies on patch to boost::coroutines::coroutine::self to introduce get_id().
Diffstat (limited to 'indra/llcommon/lleventcoro.h')
-rw-r--r--indra/llcommon/lleventcoro.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/indra/llcommon/lleventcoro.h b/indra/llcommon/lleventcoro.h
index 5726ea0f65..c6d9de171d 100644
--- a/indra/llcommon/lleventcoro.h
+++ b/indra/llcommon/lleventcoro.h
@@ -106,7 +106,14 @@ namespace LLEventDetail
* that's okay, since it won't collide with any listener name used by the
* earlier coroutine since that earlier coroutine no longer exists.
*/
- LL_COMMON_API std::string listenerNameForCoro(const void* self);
+ template <typename COROUTINE_SELF>
+ std::string listenerNameForCoro(COROUTINE_SELF& self)
+ {
+ return listenerNameForCoroImpl(self.get_id());
+ }
+
+ /// Implementation for listenerNameForCoro()
+ LL_COMMON_API std::string listenerNameForCoroImpl(const void* self_id);
/**
* Implement behavior described for postAndWait()'s @a replyPumpNamePath
@@ -185,7 +192,7 @@ LLSD postAndWait(SELF& self, const LLSD& event, const LLEventPumpOrPumpName& req
boost::coroutines::future<LLSD> future(self);
// make a callback that will assign a value to the future, and listen on
// the specified LLEventPump with that callback
- std::string listenerName(LLEventDetail::listenerNameForCoro(&self));
+ std::string listenerName(LLEventDetail::listenerNameForCoro(self));
LLTempBoundListener connection(
replyPump.getPump().listen(listenerName,
voidlistener(boost::coroutines::make_callback(future))));
@@ -307,7 +314,7 @@ LLEventWithID postAndWait2(SELF& self, const LLSD& event,
boost::coroutines::future<LLEventWithID> future(self);
// either callback will assign a value to this future; listen on
// each specified LLEventPump with a callback
- std::string name(LLEventDetail::listenerNameForCoro(&self));
+ std::string name(LLEventDetail::listenerNameForCoro(self));
LLTempBoundListener connection0(
replyPump0.getPump().listen(name + "a",
LLEventDetail::wfeoh(boost::coroutines::make_callback(future), 0)));