Exemple #1
0
 public Thread(int threadId, Machine machine, FunctionObject function)
 {
     _threadId = threadId;
     _machine  = machine;
     _function = function;
     _state    = ThreadState.Running;
 }
Exemple #2
0
        public Variable(FunctionObject Value)
        {
            _type   = VariableType.Function;
            _int    = 0;
            _float  = 0;
            _string = null;

            _refValue = Value;
        }
        /// <summary>
        /// Creates a thread with no parameters to the main function
        /// </summary>
        /// <param name="threadFunction"></param>
        /// <param name="This"></param>
        /// <returns></returns>
        public Thread CreateThread(FunctionObject threadFunction, Variable This)
        {
            Thread newThread = new Thread(_NextThreadId++, this, threadFunction);

            // TODO: Notify of thread creation
            _RunningThreads.Add(newThread);
            newThread.Push(This);// push this
            newThread.PushFunction(threadFunction);
            newThread.PushStackFrame(0);
            return(newThread);
        }
 /// <summary>
 /// Creates a thread with no parameters to the main function and Null passed as This
 /// </summary>
 /// <param name="threadFunction"></param>
 /// <returns></returns>
 public Thread CreateThread(FunctionObject threadFunction)
 {
     return(CreateThread(threadFunction, new Variable()));
 }