Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9eec782920 | ||
|
|
f7d5b41aba | ||
|
|
7f494b3d57 |
@@ -2,7 +2,7 @@ package grawt
|
||||
|
||||
type CloseHandler struct {
|
||||
waiter *Waiter
|
||||
Quit chan bool
|
||||
Quit chan struct{}
|
||||
active bool
|
||||
autoDone bool
|
||||
handlerFunc *func()
|
||||
|
||||
@@ -17,7 +17,7 @@ type Waiter struct {
|
||||
func (w *Waiter) addHandler(f *func(), autoDone bool) *CloseHandler {
|
||||
ch := CloseHandler{
|
||||
w,
|
||||
make(chan bool, 1),
|
||||
make(chan struct{}, 1),
|
||||
true,
|
||||
autoDone,
|
||||
f,
|
||||
@@ -32,7 +32,9 @@ func (w *Waiter) terminateHandler(h *CloseHandler, forceWaitGroupDone bool) {
|
||||
if h.handlerFunc != nil && *h.handlerFunc != nil {
|
||||
(*h.handlerFunc)()
|
||||
}
|
||||
h.Quit <- true
|
||||
if h.active {
|
||||
close(h.Quit)
|
||||
}
|
||||
if h.autoDone || forceWaitGroupDone {
|
||||
w.waitGroup.Done()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user