Beispiel #1
0
 public ThreadWorker(ILogger <ThreadWorker> logger, WorkTaskArgs taskArgs) : base(logger, taskArgs)
 {
     //IsBackground
     //false 默认,当主线程退出的时候,线程还会继续执行下去,直到线程执行结束,
     //         但window服务会最多等待30秒后强制关闭。
     //true;随着主线程的退出而退出
     _startThread = new Thread(new ParameterizedThreadStart(StartThreadTask));
     Interlocked.Exchange(ref _isPause, 0);
     Interlocked.Exchange(ref _isStop, 0);
 }
Beispiel #2
0
 public BaseWorker(ILogger <BaseWorker> logger, WorkTaskArgs taskArgs)
 {
     //var type = GetType();
     Logger   = logger;
     TaskArgs = taskArgs;
 }