Do not enqueue after stop. (#2457)
Else, that could leak as the process routine may have exited and the entries are not processed anywhere.
This commit is contained in:
@@ -75,8 +75,12 @@ func (oq *OpsQueue) Enqueue(op func()) {
|
|||||||
oq.lock.Lock()
|
oq.lock.Lock()
|
||||||
defer oq.lock.Unlock()
|
defer oq.lock.Unlock()
|
||||||
|
|
||||||
|
if oq.isStopped {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
oq.ops.PushBack(op)
|
oq.ops.PushBack(op)
|
||||||
if oq.ops.Len() == 1 && !oq.isStopped {
|
if oq.ops.Len() == 1 {
|
||||||
select {
|
select {
|
||||||
case oq.wake <- struct{}{}:
|
case oq.wake <- struct{}{}:
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user