diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2009-06-03 21:38:21 +0000 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2009-06-03 21:38:21 +0000 |
commit | 285613b892f41d0c72c03b8551dd003f61a5f2be (patch) | |
tree | 648299cef5fac0a373e5e3ba1e244d21ba34b42a /indra/viewer_components | |
parent | 7fe359b293db531e7ff82ef606cfa4c5c826b656 (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/viewer_components')
-rw-r--r-- | indra/viewer_components/login/lllogin.cpp | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/indra/viewer_components/login/lllogin.cpp b/indra/viewer_components/login/lllogin.cpp index 26b950b618..575a709761 100644 --- a/indra/viewer_components/login/lllogin.cpp +++ b/indra/viewer_components/login/lllogin.cpp @@ -44,8 +44,8 @@ #include "lllogin.h" #include <boost/bind.hpp> -#include <boost/scoped_ptr.hpp> +#include "llcoros.h" #include "llevents.h" #include "lleventfilter.h" #include "lleventcoro.h" @@ -109,35 +109,25 @@ private: void login_(coroutine_type::self& self, const std::string& uri, const LLSD& credentials); - boost::scoped_ptr<coroutine_type> mCoro; LLEventStream mPump; LLSD mAuthResponse, mValidAuthResponse; }; void LLLogin::Impl::connect(const std::string& uri, const LLSD& credentials) { - // If there's a previous coroutine instance, and that instance is still - // active, destroying the instance will terminate the coroutine by - // throwing an exception, thus unwinding the stack and destroying all - // local objects. It should (!) all Just Work. Nonetheless, it would be - // strange, so make a note of it. - if (mCoro && *mCoro) - { - LL_WARNS("LLLogin") << "Previous login attempt interrupted by new request" << LL_ENDL; - } - - // Construct a coroutine that will run our login_() method; placeholders - // forward the params from the (*mCoro)(etc.) call below. Using scoped_ptr - // ensures that if mCoro was already pointing to a previous instance, that - // old instance will be destroyed as noted above. - mCoro.reset(new coroutine_type(boost::bind(&Impl::login_, this, _1, _2, _3))); - // Run the coroutine until its first wait; at that point, return here. - (*mCoro)(std::nothrow, uri, credentials); + // Launch a coroutine with our login_() method; placeholders forward the + // params. Run the coroutine until its first wait; at that point, return + // here. + std::string coroname = + LLCoros::instance().launch<coroutine_type>("LLLogin::Impl::login_", + boost::bind(&Impl::login_, this, _1, _2, _3), + uri, credentials); } void LLLogin::Impl::login_(coroutine_type::self& self, const std::string& uri, const LLSD& credentials) { + LL_INFOS("LLLogin") << "Entering coroutine " << LLCoros::instance().getName(self) << LL_ENDL; // Arriving in SRVRequest state LLEventStream replyPump("reply", true); // Should be an array of one or more uri strings. |