Skip to content
Snippets Groups Projects
Commit 1d251495 authored by Nat Goodspeed's avatar Nat Goodspeed
Browse files

MAINT-5357: Add llcoro::yield() function to yield for one frame.

parent d3447635
No related branches found
No related tags found
No related merge requests found
......@@ -145,6 +145,14 @@ void storeToLLSDPath(LLSD& dest, const LLSD& rawPath, const LLSD& value)
} // anonymous
void llcoro::yield()
{
// By viewer convention, we post an event on the "mainloop" LLEventPump
// each iteration of the main event-handling loop. So waiting for a single
// event on "mainloop" gives us a one-frame yield.
waitForEventOn("mainloop");
}
LLSD llcoro::postAndWait(const LLSD& event, const LLEventPumpOrPumpName& requestPump,
const LLEventPumpOrPumpName& replyPump, const LLSD& replyPumpNamePath)
{
......
......@@ -101,6 +101,13 @@ VoidListener<LISTENER> voidlistener(const LISTENER& listener)
return VoidListener<LISTENER>(listener);
}
/**
* Yield control from a coroutine for one "mainloop" tick. If your coroutine
* runs without suspending for nontrivial time, sprinkle in calls to this
* function to avoid stalling the rest of the viewer processing.
*/
void yield();
/**
* Post specified LLSD event on the specified LLEventPump, then wait for a
* response on specified other LLEventPump. This is more than mere
......
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