make delayed workqueue use channels with single writer

This commit is contained in:
Jordan Liggitt
2016-04-06 09:23:12 -04:00
committed by deads2k
parent d12a4d6d5a
commit 290d970282
3 changed files with 179 additions and 167 deletions

View File

@@ -26,6 +26,7 @@ type Interface interface {
Get() (item interface{}, shutdown bool)
Done(item interface{})
ShutDown()
ShuttingDown() bool
}
// New constructs a new workqueue (see the package comment).
@@ -143,3 +144,10 @@ func (q *Type) ShutDown() {
q.shuttingDown = true
q.cond.Broadcast()
}
func (q *Type) ShuttingDown() bool {
q.cond.L.Lock()
defer q.cond.L.Unlock()
return q.shuttingDown
}