Exemple #1
0
 ///// <summary>
 ///// 获取一个线程并执行任务
 ///// </summary>
 ///// <typeparam name="parameterType">参数类型</typeparam>
 ///// <param name="task">任务委托</param>
 ///// <param name="parameter">线程参数</param>
 //internal void FastStart<parameterType>(pushPool<parameterType> task, ref parameterType parameter)
 //{
 //    runPushPool<parameterType> run = runPushPool<parameterType>.Pop();
 //    run.Set(task, ref parameter);
 //    FastStart(run, fastCSharp.threading.thread.callType.Run);
 //}
 /// <summary>
 /// 获取一个线程并执行任务
 /// </summary>
 /// <param name="task">任务委托</param>
 /// <param name="domainUnload">应用程序退出处理</param>
 /// <param name="onError">应用程序退出处理</param>
 private void start(Action task, Action <Exception> onError, Action domainUnload)
 {
     if (task == null)
     {
         log.Error.Throw(null, "缺少 线程委托", false);
     }
     if (isDisposed)
     {
         log.Default.Real("线程池已经被释放", null, false);
     }
     else if (domainUnload == null)
     {
         if (onError == null)
         {
             FastStart(task);
         }
         else
         {
             FastStart(task, onError);
         }
     }
     else
     {
         thread thread = threads.Pop();
         if (thread == null)
         {
             new thread(this, stackSize, task, onError, domainUnload, threading.thread.callType.Action, onError == null ? threading.thread.errorType.None : threading.thread.errorType.Action, fastCSharp.domainUnload.unloadType.Action);
         }
         else
         {
             thread.RunTask(task, onError, domainUnload, threading.thread.callType.Action, onError == null ? threading.thread.errorType.None : threading.thread.errorType.Action, fastCSharp.domainUnload.unloadType.Action);
         }
     }
 }
Exemple #2
0
        internal void FastStart(object task, object onError, fastCSharp.threading.thread.callType taskType, threading.thread.errorType errorType)
        {
            thread thread = threads.Pop();

            if (thread == null)
            {
                new thread(this, stackSize, task, onError, taskType, errorType);
            }
            else
            {
                thread.RunTask(task, onError, taskType, errorType);
            }
        }
Exemple #3
0
 internal void FastStart(Action task, Action <Exception> onError)
 {
     if (onError == null)
     {
         FastStart(task);
     }
     else
     {
         thread thread = threads.Pop();
         if (thread == null)
         {
             new thread(this, stackSize, task, onError, threading.thread.callType.Action, threading.thread.errorType.Action);
         }
         else
         {
             thread.RunTask(task, onError, threading.thread.callType.Action, threading.thread.errorType.Action);
         }
     }
 }