Improve thread shutdown logic

  • Konuyu Başlatan Konuyu Başlatan twostars
  • Başlangıç tarihi Başlangıç tarihi
  • Öne çıkan
T

twostars

Improve thread shutdown logic

Rename _running to _canTick and add _isShutdown to explicitly separate behaviour.
That is, before, a thread could no longer be running, but not yet be shutdown (i.e. the thread is technically still running).
Now a thread can continue to tick for as long as _canTick is set, but it's not until _isShutdown is set that the thread has actually finally finished running.

Additionally, ensure we always join() (when requested) on shutdown(). This ensures that if the thread was externally shutdown, we still wait for it to do so,
rather than just immediately returning.

Finally, add some error handling for join().

Github Commit Görüntüle...
See Commints...

..
 

Similar threads

K
Cevaplar
0
Görüntüleme
15
kenner2
K
T
Cevaplar
0
Görüntüleme
31
twostars
T
T
Cevaplar
0
Görüntüleme
16
twostars
T
T
Cevaplar
0
Görüntüleme
30
twostars
T
T
Cevaplar
0
Görüntüleme
14
twostars
T
Geri
Üst