Beispiel #1
0
 public Microthread(Func<IEnumerator<IYield>> func, Microthread parent = null)
 {
     _func = func;
     if (parent == null)
     {
         _root = this;
     }
     else
     {
         _parent = parent;
         _root = _parent._root;
     }
 }
Beispiel #2
0
        /// <summary>
        /// 프레임워크 내부적으로 사용되는 메소드입니다.
        /// </summary>
        /// <param name="microthread"></param>
        public void AddWaitMicrothread(Microthread microthread)
        {
            if (_isLock)
            {
                lock (_lock)
                {
                    _microthreads.Add(microthread);
                }
                return;
            }

            _microthreads.Add(microthread);
        }
Beispiel #3
0
 public static void Run(Microthread microthread)
 {
     microthread._worker.RunMicrothread(microthread);
 }
Beispiel #4
0
 public SleepData(Microthread thread, long sec)
 {
     Thread = thread;
     _time = DateTime.Now.Ticks + sec*10000000;
 }
Beispiel #5
0
 /// <summary>
 /// 해당 index에 맞는 Worker Thread에서 Microthread를 시작하는 메소드
 /// </summary>
 /// <param name="index">작업구분을 위한 index</param>
 /// <param name="microthread">시작할 Microthread</param>
 public void RunMicrothread(int index, Microthread microthread)
 {
     _workers[index % _workers.Length].RunMicrothread(microthread);
 }
Beispiel #6
0
 /// <summary>
 /// Microthread를 시작하는 메소드
 /// </summary>
 /// <param name="microthread">시작할 Microthread</param>
 public void RunMicrothread(Microthread microthread)
 {
     QueueWorkItem(() => microthread.Run(this));
 }