grawt/close_handler.go
2020-08-13 15:26:57 +03:00

21 lines
316 B
Go

package grawt
import "sync"
type CloseHandler struct {
sync.Mutex
waiter *Waiter
Quit chan struct{}
active bool
autoDone bool
handlerFunc *func()
}
func (ch *CloseHandler) Halt(err error) {
ch.waiter.Halt(err)
}
func (ch *CloseHandler) Done() {
ch.waiter.terminateHandler(ch, true)
}