submit adds an operation to the queue or returns an error if the queue is full
(op func())
| 31 | |
| 32 | // submit adds an operation to the queue or returns an error if the queue is full |
| 33 | func (q *asyncQueue) submit(op func()) error { |
| 34 | select { |
| 35 | case q.queueCh <- op: |
| 36 | return nil |
| 37 | default: |
| 38 | return errAsyncQueueFull |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | func (q *asyncQueue) stop() { |
| 43 | close(q.stopCh) |
no outgoing calls