Skip to content
Snippets Groups Projects
Commit a8ab0846 authored by Rider Linden's avatar Rider Linden
Browse files

Tweek to naming postEventAndSuspend -> postAndSuspend

parent 75c6549f
No related branches found
No related tags found
No related merge requests found
...@@ -73,7 +73,7 @@ std::string listenerNameForCoro() ...@@ -73,7 +73,7 @@ std::string listenerNameForCoro()
} }
/** /**
* Implement behavior described for postEventAndSuspend()'s @a replyPumpNamePath * Implement behavior described for postAndSuspend()'s @a replyPumpNamePath
* parameter: * parameter:
* *
* * If <tt>path.isUndefined()</tt>, do nothing. * * If <tt>path.isUndefined()</tt>, do nothing.
...@@ -153,7 +153,7 @@ void llcoro::suspend() ...@@ -153,7 +153,7 @@ void llcoro::suspend()
suspendUntilEventOn("mainloop"); suspendUntilEventOn("mainloop");
} }
LLSD llcoro::postEventAndSuspend(const LLSD& event, const LLEventPumpOrPumpName& requestPump, LLSD llcoro::postAndSuspend(const LLSD& event, const LLEventPumpOrPumpName& requestPump,
const LLEventPumpOrPumpName& replyPump, const LLSD& replyPumpNamePath) const LLEventPumpOrPumpName& replyPump, const LLSD& replyPumpNamePath)
{ {
// declare the future // declare the future
...@@ -171,7 +171,7 @@ LLSD llcoro::postEventAndSuspend(const LLSD& event, const LLEventPumpOrPumpName& ...@@ -171,7 +171,7 @@ LLSD llcoro::postEventAndSuspend(const LLSD& event, const LLEventPumpOrPumpName&
// request event. // request event.
LLSD modevent(event); LLSD modevent(event);
storeToLLSDPath(modevent, replyPumpNamePath, replyPump.getPump().getName()); storeToLLSDPath(modevent, replyPumpNamePath, replyPump.getPump().getName());
LL_DEBUGS("lleventcoro") << "postEventAndSuspend(): coroutine " << listenerName LL_DEBUGS("lleventcoro") << "postAndSuspend(): coroutine " << listenerName
<< " posting to " << requestPump.getPump().getName() << " posting to " << requestPump.getPump().getName()
<< LL_ENDL; << LL_ENDL;
...@@ -179,7 +179,7 @@ LLSD llcoro::postEventAndSuspend(const LLSD& event, const LLEventPumpOrPumpName& ...@@ -179,7 +179,7 @@ LLSD llcoro::postEventAndSuspend(const LLSD& event, const LLEventPumpOrPumpName&
// << ": " << modevent << LL_ENDL; // << ": " << modevent << LL_ENDL;
requestPump.getPump().post(modevent); requestPump.getPump().post(modevent);
} }
LL_DEBUGS("lleventcoro") << "postEventAndSuspend(): coroutine " << listenerName LL_DEBUGS("lleventcoro") << "postAndSuspend(): coroutine " << listenerName
<< " about to wait on LLEventPump " << replyPump.getPump().getName() << " about to wait on LLEventPump " << replyPump.getPump().getName()
<< LL_ENDL; << LL_ENDL;
// trying to dereference ("resolve") the future makes us wait for it // trying to dereference ("resolve") the future makes us wait for it
...@@ -189,7 +189,7 @@ LLSD llcoro::postEventAndSuspend(const LLSD& event, const LLEventPumpOrPumpName& ...@@ -189,7 +189,7 @@ LLSD llcoro::postEventAndSuspend(const LLSD& event, const LLEventPumpOrPumpName&
llcoro::Suspending suspended; llcoro::Suspending suspended;
value = *future; value = *future;
} // destroy Suspending as soon as we're back } // destroy Suspending as soon as we're back
LL_DEBUGS("lleventcoro") << "postEventAndSuspend(): coroutine " << listenerName LL_DEBUGS("lleventcoro") << "postAndSuspend(): coroutine " << listenerName
<< " resuming with " << value << LL_ENDL; << " resuming with " << value << LL_ENDL;
// returning should disconnect the connection // returning should disconnect the connection
return value; return value;
...@@ -242,7 +242,7 @@ WaitForEventOnHelper<LISTENER> wfeoh(const LISTENER& listener, int discriminator ...@@ -242,7 +242,7 @@ WaitForEventOnHelper<LISTENER> wfeoh(const LISTENER& listener, int discriminator
namespace llcoro namespace llcoro
{ {
LLEventWithID postEventAndSuspend2(const LLSD& event, LLEventWithID postAndSuspend2(const LLSD& event,
const LLEventPumpOrPumpName& requestPump, const LLEventPumpOrPumpName& requestPump,
const LLEventPumpOrPumpName& replyPump0, const LLEventPumpOrPumpName& replyPump0,
const LLEventPumpOrPumpName& replyPump1, const LLEventPumpOrPumpName& replyPump1,
...@@ -270,12 +270,12 @@ LLEventWithID postEventAndSuspend2(const LLSD& event, ...@@ -270,12 +270,12 @@ LLEventWithID postEventAndSuspend2(const LLSD& event,
replyPump0.getPump().getName()); replyPump0.getPump().getName());
storeToLLSDPath(modevent, replyPump1NamePath, storeToLLSDPath(modevent, replyPump1NamePath,
replyPump1.getPump().getName()); replyPump1.getPump().getName());
LL_DEBUGS("lleventcoro") << "postEventAndSuspend2(): coroutine " << name LL_DEBUGS("lleventcoro") << "postAndSuspend2(): coroutine " << name
<< " posting to " << requestPump.getPump().getName() << " posting to " << requestPump.getPump().getName()
<< ": " << modevent << LL_ENDL; << ": " << modevent << LL_ENDL;
requestPump.getPump().post(modevent); requestPump.getPump().post(modevent);
} }
LL_DEBUGS("lleventcoro") << "postEventAndSuspend2(): coroutine " << name LL_DEBUGS("lleventcoro") << "postAndSuspend2(): coroutine " << name
<< " about to wait on LLEventPumps " << replyPump0.getPump().getName() << " about to wait on LLEventPumps " << replyPump0.getPump().getName()
<< ", " << replyPump1.getPump().getName() << LL_ENDL; << ", " << replyPump1.getPump().getName() << LL_ENDL;
// trying to dereference ("resolve") the future makes us wait for it // trying to dereference ("resolve") the future makes us wait for it
...@@ -285,7 +285,7 @@ LLEventWithID postEventAndSuspend2(const LLSD& event, ...@@ -285,7 +285,7 @@ LLEventWithID postEventAndSuspend2(const LLSD& event,
llcoro::Suspending suspended; llcoro::Suspending suspended;
value = *future; value = *future;
} // destroy Suspending as soon as we're back } // destroy Suspending as soon as we're back
LL_DEBUGS("lleventcoro") << "postEventAndSuspend(): coroutine " << name LL_DEBUGS("lleventcoro") << "postAndSuspend(): coroutine " << name
<< " resuming with (" << value.first << ", " << value.second << ")" << " resuming with (" << value.first << ", " << value.second << ")"
<< LL_ENDL; << LL_ENDL;
// returning should disconnect both connections // returning should disconnect both connections
......
...@@ -123,14 +123,14 @@ void suspend(); ...@@ -123,14 +123,14 @@ void suspend();
* entered. Therefore, the coroutine completely misses an immediate reply * entered. Therefore, the coroutine completely misses an immediate reply
* event, making it suspend indefinitely. * event, making it suspend indefinitely.
* *
* By contrast, postEventAndSuspend() listens on the @a replyPump @em before posting * By contrast, postAndSuspend() listens on the @a replyPump @em before posting
* the specified LLSD event on the specified @a requestPump. * the specified LLSD event on the specified @a requestPump.
* *
* @param event LLSD data to be posted on @a requestPump * @param event LLSD data to be posted on @a requestPump
* @param requestPump an LLEventPump on which to post @a event. Pass either * @param requestPump an LLEventPump on which to post @a event. Pass either
* the LLEventPump& or its string name. However, if you pass a * the LLEventPump& or its string name. However, if you pass a
* default-constructed @c LLEventPumpOrPumpName, we skip the post() call. * default-constructed @c LLEventPumpOrPumpName, we skip the post() call.
* @param replyPump an LLEventPump on which postEventAndSuspend() will listen for a * @param replyPump an LLEventPump on which postAndSuspend() will listen for a
* reply. Pass either the LLEventPump& or its string name. The calling * reply. Pass either the LLEventPump& or its string name. The calling
* coroutine will suspend until that reply arrives. (If you're concerned about a * coroutine will suspend until that reply arrives. (If you're concerned about a
* reply that might not arrive, please see also LLEventTimeout.) * reply that might not arrive, please see also LLEventTimeout.)
...@@ -155,7 +155,7 @@ void suspend(); ...@@ -155,7 +155,7 @@ void suspend();
* @a replyPumpNamePath specifies the entry in the lowest-level structure in * @a replyPumpNamePath specifies the entry in the lowest-level structure in
* @a event into which to store <tt>replyPump.getName()</tt>. * @a event into which to store <tt>replyPump.getName()</tt>.
*/ */
LLSD postEventAndSuspend(const LLSD& event, const LLEventPumpOrPumpName& requestPump, LLSD postAndSuspend(const LLSD& event, const LLEventPumpOrPumpName& requestPump,
const LLEventPumpOrPumpName& replyPump, const LLSD& replyPumpNamePath=LLSD()); const LLEventPumpOrPumpName& replyPump, const LLSD& replyPumpNamePath=LLSD());
/// Wait for the next event on the specified LLEventPump. Pass either the /// Wait for the next event on the specified LLEventPump. Pass either the
...@@ -163,8 +163,8 @@ LLSD postEventAndSuspend(const LLSD& event, const LLEventPumpOrPumpName& request ...@@ -163,8 +163,8 @@ LLSD postEventAndSuspend(const LLSD& event, const LLEventPumpOrPumpName& request
inline inline
LLSD suspendUntilEventOn(const LLEventPumpOrPumpName& pump) LLSD suspendUntilEventOn(const LLEventPumpOrPumpName& pump)
{ {
// This is now a convenience wrapper for postEventAndSuspend(). // This is now a convenience wrapper for postAndSuspend().
return postEventAndSuspend(LLSD(), LLEventPumpOrPumpName(), pump); return postAndSuspend(LLSD(), LLEventPumpOrPumpName(), pump);
} }
} // namespace llcoro } // namespace llcoro
...@@ -201,10 +201,10 @@ namespace llcoro ...@@ -201,10 +201,10 @@ namespace llcoro
* the single-pump function) or LLEventOrPumpName (@a replyPump1 for two-pump * the single-pump function) or LLEventOrPumpName (@a replyPump1 for two-pump
* function). * function).
* *
* It seems less burdensome to write postEventAndSuspend2() than to write either * It seems less burdensome to write postAndSuspend2() than to write either
* LLSD("someString") or LLEventOrPumpName("someString"). * LLSD("someString") or LLEventOrPumpName("someString").
*/ */
LLEventWithID postEventAndSuspend2(const LLSD& event, LLEventWithID postAndSuspend2(const LLSD& event,
const LLEventPumpOrPumpName& requestPump, const LLEventPumpOrPumpName& requestPump,
const LLEventPumpOrPumpName& replyPump0, const LLEventPumpOrPumpName& replyPump0,
const LLEventPumpOrPumpName& replyPump1, const LLEventPumpOrPumpName& replyPump1,
...@@ -218,8 +218,8 @@ inline ...@@ -218,8 +218,8 @@ inline
LLEventWithID LLEventWithID
suspendUntilEventOn(const LLEventPumpOrPumpName& pump0, const LLEventPumpOrPumpName& pump1) suspendUntilEventOn(const LLEventPumpOrPumpName& pump0, const LLEventPumpOrPumpName& pump1)
{ {
// This is now a convenience wrapper for postEventAndSuspend2(). // This is now a convenience wrapper for postAndSuspend2().
return postEventAndSuspend2(LLSD(), LLEventPumpOrPumpName(), pump0, pump1); return postAndSuspend2(LLSD(), LLEventPumpOrPumpName(), pump0, pump1);
} }
/** /**
...@@ -312,7 +312,7 @@ class LL_COMMON_API LLCoroEventPump ...@@ -312,7 +312,7 @@ class LL_COMMON_API LLCoroEventPump
LLSD postAndSuspend(const LLSD& event, const LLEventPumpOrPumpName& requestPump, LLSD postAndSuspend(const LLSD& event, const LLEventPumpOrPumpName& requestPump,
const LLSD& replyPumpNamePath=LLSD()) const LLSD& replyPumpNamePath=LLSD())
{ {
return llcoro::postEventAndSuspend(event, requestPump, mPump, replyPumpNamePath); return llcoro::postAndSuspend(event, requestPump, mPump, replyPumpNamePath);
} }
private: private:
...@@ -371,7 +371,7 @@ class LL_COMMON_API LLCoroEventPumps ...@@ -371,7 +371,7 @@ class LL_COMMON_API LLCoroEventPumps
const LLSD& replyPump0NamePath=LLSD(), const LLSD& replyPump0NamePath=LLSD(),
const LLSD& replyPump1NamePath=LLSD()) const LLSD& replyPump1NamePath=LLSD())
{ {
return llcoro::postEventAndSuspend2(event, requestPump, mPump0, mPump1, return llcoro::postAndSuspend2(event, requestPump, mPump0, mPump1,
replyPump0NamePath, replyPump1NamePath); replyPump0NamePath, replyPump1NamePath);
} }
......
...@@ -129,7 +129,7 @@ typedef coroutine<std::string::iterator(void)> match_coroutine_type; ...@@ -129,7 +129,7 @@ typedef coroutine<std::string::iterator(void)> match_coroutine_type;
*****************************************************************************/ *****************************************************************************/
/// Simulate an event API whose response is immediate: sent on receipt of the /// Simulate an event API whose response is immediate: sent on receipt of the
/// initial request, rather than after some delay. This is the case that /// initial request, rather than after some delay. This is the case that
/// distinguishes postEventAndSuspend() from calling post(), then calling /// distinguishes postAndSuspend() from calling post(), then calling
/// suspendUntilEventOn(). /// suspendUntilEventOn().
class ImmediateAPI class ImmediateAPI
{ {
...@@ -532,7 +532,7 @@ namespace tut ...@@ -532,7 +532,7 @@ namespace tut
{ {
BEGIN BEGIN
{ {
result = postEventAndSuspend(LLSDMap("value", 17), // request event result = postAndSuspend(LLSDMap("value", 17), // request event
immediateAPI.getPump(), // requestPump immediateAPI.getPump(), // requestPump
"reply1", // replyPump "reply1", // replyPump
"reply"); // request["reply"] = name "reply"); // request["reply"] = name
...@@ -554,7 +554,7 @@ namespace tut ...@@ -554,7 +554,7 @@ namespace tut
{ {
BEGIN BEGIN
{ {
LLEventWithID pair = ::postEventAndSuspend2(LLSDMap("value", 18), LLEventWithID pair = ::postAndSuspend2(LLSDMap("value", 18),
immediateAPI.getPump(), immediateAPI.getPump(),
"reply2", "reply2",
"error2", "error2",
...@@ -582,7 +582,7 @@ namespace tut ...@@ -582,7 +582,7 @@ namespace tut
{ {
BEGIN BEGIN
{ {
LLEventWithID pair = ::postEventAndSuspend2(LLSDMap("value", 18)("fail", LLSD()), LLEventWithID pair = ::postAndSuspend2(LLSDMap("value", 18)("fail", LLSD()),
immediateAPI.getPump(), immediateAPI.getPump(),
"reply2", "reply2",
"error2", "error2",
......
...@@ -175,7 +175,7 @@ void LLLogin::Impl::login_(std::string uri, LLSD login_params) ...@@ -175,7 +175,7 @@ void LLLogin::Impl::login_(std::string uri, LLSD login_params)
request["op"] = "rewriteURI"; request["op"] = "rewriteURI";
request["uri"] = uri; request["uri"] = uri;
request["reply"] = replyPump.getName(); request["reply"] = replyPump.getName();
rewrittenURIs = llcoro::postEventAndSuspend(request, srv_pump_name, filter); rewrittenURIs = llcoro::postAndSuspend(request, srv_pump_name, filter);
// EXP-772: If rewrittenURIs fail, try original URI as a fallback. // EXP-772: If rewrittenURIs fail, try original URI as a fallback.
rewrittenURIs.append(uri); rewrittenURIs.append(uri);
} // we no longer need the filter } // we no longer need the filter
...@@ -215,13 +215,13 @@ void LLLogin::Impl::login_(std::string uri, LLSD login_params) ...@@ -215,13 +215,13 @@ void LLLogin::Impl::login_(std::string uri, LLSD login_params)
sendProgressEvent("offline", "authenticating", progress_data); sendProgressEvent("offline", "authenticating", progress_data);
// We expect zero or more "Downloading" status events, followed by // We expect zero or more "Downloading" status events, followed by
// exactly one event with some other status. Use postEventAndSuspend() the // exactly one event with some other status. Use postAndSuspend() the
// first time, because -- at least in unit-test land -- it's // first time, because -- at least in unit-test land -- it's
// possible for the reply to arrive before the post() call // possible for the reply to arrive before the post() call
// returns. Subsequent responses, of course, must be awaited // returns. Subsequent responses, of course, must be awaited
// without posting again. // without posting again.
for (mAuthResponse = validateResponse(loginReplyPump.getName(), for (mAuthResponse = validateResponse(loginReplyPump.getName(),
llcoro::postEventAndSuspend(request, xmlrpcPump, loginReplyPump, "reply")); llcoro::postAndSuspend(request, xmlrpcPump, loginReplyPump, "reply"));
mAuthResponse["status"].asString() == "Downloading"; mAuthResponse["status"].asString() == "Downloading";
mAuthResponse = validateResponse(loginReplyPump.getName(), mAuthResponse = validateResponse(loginReplyPump.getName(),
llcoro::suspendUntilEventOn(loginReplyPump))) llcoro::suspendUntilEventOn(loginReplyPump)))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment