Use 'chan struct{}' instead of 'chan bool' for quit channel for compatibility, up to 0.1.3

This commit is contained in:
jar3b 2019-06-18 00:50:05 +03:00
parent ac0f979ef9
commit 7f494b3d57
2 changed files with 3 additions and 3 deletions

View File

@ -2,7 +2,7 @@ package grawt
type CloseHandler struct { type CloseHandler struct {
waiter *Waiter waiter *Waiter
Quit chan bool Quit chan struct{}
active bool active bool
autoDone bool autoDone bool
handlerFunc *func() handlerFunc *func()

View File

@ -17,7 +17,7 @@ type Waiter struct {
func (w *Waiter) addHandler(f *func(), autoDone bool) *CloseHandler { func (w *Waiter) addHandler(f *func(), autoDone bool) *CloseHandler {
ch := CloseHandler{ ch := CloseHandler{
w, w,
make(chan bool, 1), make(chan struct{}, 1),
true, true,
autoDone, autoDone,
f, f,
@ -32,7 +32,7 @@ func (w *Waiter) terminateHandler(h *CloseHandler, forceWaitGroupDone bool) {
if h.handlerFunc != nil && *h.handlerFunc != nil { if h.handlerFunc != nil && *h.handlerFunc != nil {
(*h.handlerFunc)() (*h.handlerFunc)()
} }
h.Quit <- true h.Quit <- struct{}{}
if h.autoDone || forceWaitGroupDone { if h.autoDone || forceWaitGroupDone {
w.waitGroup.Done() w.waitGroup.Done()
} }