} // func Yield #endregion #region -- ExecuteDelegate ---------------------------------------------------- private void ExecuteDelegate() { evResume = new ManualResetEventSlim(false); Task.Yield(); // force background thread // add this thread to the thread-pool lock (luaThreads) luaThreads.Add(this); try { yield(new LuaResult(Lua.RtInvoke(target, currentArguments.Values))); } finally { // remove the thread from the pool lock (luaThreads) luaThreads.Remove(this); taskExecute = null; taskCancelExecute.Dispose(); taskCancelExecute = null; // dispose the events currentYield = LuaResult.Empty; evResume.Dispose(); evResume = null; evYield.Set(); } } // proc ExecuteDelegate
} // func Yield #endregion #region -- ExecuteDelegate -------------------------------------------------------- private void ExecuteDelegate() { evResume = new ManualResetEventSlim(false); // add this thread to the thread-pool iCoroutineThreadId = Thread.CurrentThread.ManagedThreadId; lock (luaThreads) luaThreads.Add(this); yield(new LuaResult(Lua.RtInvoke(target, currentArguments.Values))); } // proc ExecuteDelegate