11 #include "addons/IAddon.h" 12 #include "interfaces/generic/ILanguageInvoker.h" 13 #include "threads/CriticalSection.h" 21 typedef std::shared_ptr<CLanguageInvokerThread> CLanguageInvokerThreadPtr;
32 void RegisterLanguageInvocationHandler(
ILanguageInvocationHandler *invocationHandler,
const std::set<std::string> &extensions);
34 bool HasLanguageInvoker(
const std::string &script)
const;
35 LanguageInvokerPtr GetLanguageInvoker(
const std::string& script);
51 const ADDON::AddonPtr& addon = ADDON::AddonPtr(),
52 const std::vector<std::string>& arguments = std::vector<std::string>(),
53 bool reuseable =
false,
54 int pluginHandle = -1);
65 const LanguageInvokerPtr& languageInvoker,
66 const ADDON::AddonPtr& addon = ADDON::AddonPtr(),
67 const std::vector<std::string>& arguments = std::vector<std::string>(),
68 bool reuseable =
false,
69 int pluginHandle = -1);
88 const ADDON::AddonPtr& addon = ADDON::AddonPtr(),
89 const std::vector<std::string>& arguments = std::vector<std::string>(),
90 uint32_t timeoutMs = 0,
91 bool waitShutdown =
false);
110 const LanguageInvokerPtr& languageInvoker,
111 const ADDON::AddonPtr& addon = ADDON::AddonPtr(),
112 const std::vector<std::string>& arguments = std::vector<std::string>(),
113 uint32_t timeoutMs = 0,
114 bool waitShutdown =
false);
115 bool Stop(
int scriptId,
bool wait =
false);
116 bool Stop(
const std::string &scriptPath,
bool wait =
false);
124 bool IsRunning(
int scriptId)
const;
125 bool IsRunning(
const std::string& scriptPath)
const;
130 void OnExecutionDone(
int scriptId);
139 CLanguageInvokerThreadPtr
thread;
142 } LanguageInvokerThread;
143 typedef std::map<int, LanguageInvokerThread> LanguageInvokerThreadMap;
144 typedef std::map<std::string, ILanguageInvocationHandler*> LanguageInvocationHandlerMap;
146 LanguageInvokerThread getInvokerThread(
int scriptId)
const;
148 LanguageInvocationHandlerMap m_invocationHandlers;
149 LanguageInvokerThreadMap m_scripts;
150 CLanguageInvokerThreadPtr m_lastInvokerThread;
151 int m_lastPluginHandle = -1;
153 std::map<std::string, int> m_scriptPaths;
155 mutable CCriticalSection m_critSection;
Definition: LanguageInvokerThread.h:19
int GetReusablePluginHandle(const std::string &script)
Returns addon_handle if last reusable invoker is ready to use.
Definition: ScriptInvocationManager.cpp:178
Definition: ILanguageInvocationHandler.h:13
Definition: TestHelpers.h:60
int ExecuteAsync(const std::string &script, const ADDON::AddonPtr &addon=ADDON::AddonPtr(), const std::vector< std::string > &arguments=std::vector< std::string >(), bool reuseable=false, int pluginHandle=-1)
Executes the given script asynchronously in a separate thread.
Definition: ScriptInvocationManager.cpp:219
void StopRunningScripts(bool wait=false)
Stop all running scripts.
Definition: ScriptInvocationManager.cpp:360
Definition: ScriptInvocationManager.h:23
int ExecuteSync(const std::string &script, const ADDON::AddonPtr &addon=ADDON::AddonPtr(), const std::vector< std::string > &arguments=std::vector< std::string >(), uint32_t timeoutMs=0, bool waitShutdown=false)
Executes the given script synchronously.
Definition: ScriptInvocationManager.cpp:293