Exemplo n.º 1
0
            public bool Evaluate(IntercalThreadProc proc, int label)
            {
                var frame = new ExecutionFrame(this, proc, label);

                lock (SyncLock)
                {
                    NextingStack.Push(frame);
                }

                bool result = frame.Start();

                return(result);
            }
Exemplo n.º 2
0
            public void Run(IntercalThreadProc proc)
            {
                StartProc sp = Evaluate;

                sp.BeginInvoke(proc, 0, ar => sp.EndInvoke(ar), null);

                lock (SyncLock)
                {
                    while (!Done)
                    {
                        Monitor.Wait(SyncLock);
                    }
                }

                if (CurrentException != null)
                {
                    throw CurrentException;
                }
            }
Exemplo n.º 3
0
        public bool Start()
        {
            //Note that the only reason we need to spin up a new thread
            //is the lurking possiblity of FORGET. If we could guarantee that
            //the function referenced by this.Proc never does a FORGET then
            //we could just make a direct function call.

            var myThread = new IntercalThreadProc(InternalThreadProc);

            myThread.BeginInvoke(this, ar => myThread.EndInvoke(ar), null);

            lock (SyncLock)
            {
                while (!Complete)
                {
                    Monitor.Wait(SyncLock);
                }
            }

            return(Result);
        }
Exemplo n.º 4
0
 public ExecutionFrame(ExecutionContext context, IntercalThreadProc proc, int label)
 {
     ExecutionContext = context;
     Proc             = proc;
     Label            = label;
 }