Work in progress

This work extends AIStateMachine to run multiplex() in the thread
that calls run(), cont() or set_state(). Note that all three
eventually call locked_cont(), so thats where multiplex() is called
from. Calling multiplex() means "running the state machine", as in
"calling multiplex_impl".

Currently only LLURLRequest uses this feature, and then only
for the HTTPGetResponder, and well only for the initializing,
start up and normal finish states.

A current/remaining problem is that we run into a situation where
the curl thread runs a statemachine to it's finish and kills it,
while the main thread is also 'running' it and tries to call
multiplex while the statemachine isn't running anymore.
This commit is contained in:
Aleric Inglewood
2013-02-20 23:29:34 +01:00
parent ff3910a705
commit ef35aa7954
14 changed files with 235 additions and 75 deletions

View File

@@ -83,6 +83,24 @@ LLURLRequest::LLURLRequest(LLURLRequest::ERequestAction action, std::string cons
{
}
bool LLURLRequest::thread_safe_impl(void) const
{
if (base_state() == bs_run &&
(mRunState == AICurlEasyRequestStateMachine_removed_after_finished ||
mRunState == AICurlEasyRequestStateMachine_addRequest) &&
mResponder->thread_safe_complete())
{
return true;
}
// AICurlEasyRequestStateMachine::initialize_impl is thread safe because the statemachine
// will only just have been created and no other thread can know of this instance.
if (base_state() == bs_initialize)
return true;
return false;
}
void LLURLRequest::initialize_impl(void)
{
// If the header is "Pragma" with no value, the caller intends to