thread: started should be reset after Loop

This commit is contained in:
Hajime Hoshi 2019-06-06 00:21:44 +09:00
parent 85dcafe176
commit 9c283d45b4

View File

@ -38,6 +38,8 @@ func New() *Thread {
// Loop must be called on the thread.
func (t *Thread) Loop(ch <-chan error) error {
atomic.StoreInt32(&t.started, 1)
defer atomic.StoreInt32(&t.started, 0)
for {
select {
case f := <-t.funcs: