From 911858d8d7cab0108f1c14abd676ad37ccb9c95a Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Mon, 5 Aug 2013 19:19:51 +0200 Subject: Adding a helper to LuaExecCell to find the LuaMainTask, and making the exec() call interruptible. --- src/LuaTask.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/LuaTask.cc') diff --git a/src/LuaTask.cc b/src/LuaTask.cc index a549563..cc0bb60 100644 --- a/src/LuaTask.cc +++ b/src/LuaTask.cc @@ -101,11 +101,18 @@ void Balau::LuaTask::Do() { } void Balau::LuaExecCell::exec(LuaMainTask * mainTask) { + if (m_running) + return; + m_running = true; if (!m_detached) Task::prepare(&m_event); mainTask->exec(this); if (!m_detached) - Task::operationYield(&m_event); + Task::operationYield(&m_event, Task::INTERRUPTIBLE); +} + +void Balau::LuaExecCell::exec(Lua & L) { + exec(LuaMainTask::getMainTask(L)); } void Balau::LuaExecCell::throwError() throw (GeneralException) { -- cgit v1.2.3