Example #1
0
        /// <summary>
        /// Creates a new LuaThread for the given action.
        /// </summary>
        /// <param name="action">The method to invoke.</param>
        /// <returns>A new LuaThread object that will invoke the given method.</returns>
        /// <exception cref="System.ArgumentNullException">If action is null.</exception>
        public ILuaThread Create(ILuaValue action)
        {
            lock (_lock) {
                _checkDisposed();
                _resizePool();
                WorkerThread thread = _waitingThreads.Dequeue();

                thread.DoWork(action);
                return(thread.Target);
            }
        }
Example #2
0
        /// <summary>
        /// Creates a new LuaThread for the given action.
        /// </summary>
        /// <param name="action">The method to invoke.</param>
        /// <returns>A new LuaThread object that will invoke the given method.</returns>
        /// <exception cref="System.ArgumentNullException">If action is null.</exception>
        public ILuaThread Create(ILuaValue action)
        {
            lock (lock_)
            {
                CheckDisposed();
                ResizePool();
                WorkerThread thread = waitingThreads_.Dequeue();

                thread.DoWork(action);
                return(thread.Target);
            }
        }