Beispiel #1
0
 public override void Dispose()
 {
     State = FiberFlag.Complete;
     lock (lockObj)
     {
         SetQueue.Clear();
     }
     base.Dispose();
 }
Beispiel #2
0
        public bool ThreadRun()
        {
            lock (lockObj)
            {
                model = null;

                if (SetQueue.Count > 0)
                {
                    model = SetQueue.Peek();
                }
                else
                {
                    return(false);
                }



                if (model != null)
                {
                    Console.WriteLine("Id:" + System.Threading.Thread.CurrentThread.ManagedThreadId);

                    RES res = Resume(model.value);

                    if (model.ResCallBack != null)
                    {
                        model.ResCallBack(res);
                    }


                    if (state == FiberStateEnum.FiberStopped)
                    {
                        SetQueue.Clear();
                        State = FiberFlag.Complete;
                    }

                    SetQueue.Dequeue();

                    return(true);
                }
                SetQueue.Dequeue();
                return(false);
            }
        }