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

            _refValue = Value;
        }
Exemplo n.º 3
0
        /// <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);
        }
Exemplo n.º 4
0
 /// <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()));
 }