/// <summary> /// 运行线程 /// </summary> private void runBackground() { try { do { try { do { //if (domainUnload.Type == AutoCSer.DomainUnload.Type.None) task.Call(); //else //{ // AutoCSer.DomainUnload.Unloader.Add(ref domainUnload); task.Call(); // domainUnload.Type = AutoCSer.DomainUnload.Type.None; // AutoCSer.DomainUnload.Unloader.Remove(ref domainUnload); //} task.Value = null; //onError = null; if (threadPool.Push(this)) { return; } waitHandle.Wait(); }while (task.Type != CallType.None); return; } catch (Exception error) { AutoCSer.Log.Pub.Log.Add(AutoCSer.Log.LogType.Error, error); //try //{ // if (onError == null) AutoCSer.Log.Pub.Log.add(AutoCSer.Log.LogType.Error, error); // else onError(error); //} //catch (Exception error1) //{ // AutoCSer.Log.Pub.Log.add(AutoCSer.Log.LogType.Debug, error1); //} } finally { task.Value = null; //onError = null; //if (domainUnload.Type != AutoCSer.DomainUnload.Type.None) AutoCSer.DomainUnload.Unloader.Remove(ref domainUnload); } if (threadPool.Push(this)) { return; } waitHandle.Wait(); }while (task.Type != CallType.None); } finally { removeThread(); } }