m_Functions.erase(name);
}
-void PythonInterpreter::ProcessCall(const ScriptTask::Ptr& task, const String& function,
- const std::vector<Value>& arguments)
+Value PythonInterpreter::ProcessCall(const String& function, const std::vector<Value>& arguments)
{
ObjectLock olock(this);
Value vresult = PythonLanguage::MarshalFromPython(result);
Py_DECREF(result);
- task->FinishResult(vresult);
+ m_Language->SetCurrentInterpreter(interp);
+ PyEval_ReleaseThread(m_ThreadState);
+
+ return vresult;
} catch (...) {
- task->FinishException(boost::current_exception());
- }
+ m_Language->SetCurrentInterpreter(interp);
+ PyEval_ReleaseThread(m_ThreadState);
- m_Language->SetCurrentInterpreter(interp);
- PyEval_ReleaseThread(m_ThreadState);
+ throw;
+ }
}
PyThreadState *m_ThreadState;
std::map<String, PyObject *> m_Functions;
- virtual void ProcessCall(const ScriptTask::Ptr& task, const String& function,
- const std::vector<Value>& arguments);
+ virtual Value ProcessCall(const String& function, const std::vector<Value>& arguments);
};
}
#include "python/pythonlanguage.h"
#include "python/pythoninterpreter.h"
+#include "base/scriptfunction.h"
#include "base/dynamictype.h"
#include "base/objectlock.h"
#include "base/application.h"
Value result;
try {
- ScriptTask::Ptr task = boost::make_shared<ScriptTask>(function, arguments);
- task->Start();
- result = task->GetResult();
+ result = function->Invoke(arguments);
} catch (const std::exception& ex) {
PyEval_RestoreThread(tstate);