public void Join(TimeSpan time) { LogWrite("Join"); if (_thread != null && _thread.IsAlive) { _threadCmd = ThreadCmd.Stop; _eventState.Set(); try { if (!_thread.Join(time)) { _thread.Abort(); LogWrite("Abort"); } else { LogWrite("Join"); } } catch (Exception ex) { LogWrite("Join", ex); } } }
public void Start() { LogWrite("Start"); try { Init(); } catch (Exception ex) { LogError("Start->Init", ex); } SetTimer(); //NOTE: after init, may call callback while Init in progress _threadCmd = ThreadCmd.Run; }
public void Start() { LogWrite("Start"); if (_thread != null && _thread.IsAlive) { Stop(); } _cancellationTokenSource = new CancellationTokenSource(); CancellationToken = _cancellationTokenSource.Token; _threadCmd = ThreadCmd.Run; _thread = new Thread(Run); _thread.Priority = ThreadPriority; _thread.IsBackground = true; _thread.Start(); }
public void Join(TimeSpan time) { LogWrite("Join"); if (_timer != null) { _threadCmd = ThreadCmd.Stop; try { _timer.Dispose(); } catch (Exception ex) { LogError("Join", ex); } _timer = null; } }