(ctx context.Context, front bool, callback CallbackFunc)
| 40 | } |
| 41 | |
| 42 | func (v *Queue) enqueue(ctx context.Context, front bool, callback CallbackFunc) { |
| 43 | v.monitor.L.Lock() |
| 44 | defer v.monitor.L.Unlock() |
| 45 | |
| 46 | v.enqueuedWork++ |
| 47 | |
| 48 | // add to the queue and signal one reader |
| 49 | if front { |
| 50 | v.queueItems.PushFront(callback) |
| 51 | } else { |
| 52 | v.queueItems.PushBack(callback) |
| 53 | } |
| 54 | |
| 55 | v.maybeReportProgress(ctx) |
| 56 | v.monitor.Signal() |
| 57 | } |
| 58 | |
| 59 | // Process starts N workers, which will be processing elements in the queue until the queue |
| 60 | // is empty and all workers are idle or until any of the workers returns an error. |
no test coverage detected