MCPcopy
hub / github.com/kopia/kopia / enqueue

Method enqueue

internal/parallelwork/parallel_work_queue.go:42–57  ·  view source on GitHub ↗
(ctx context.Context, front bool, callback CallbackFunc)

Source from the content-addressed store, hash-verified

40}
41
42func (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.

Callers 2

EnqueueFrontMethod · 0.95
EnqueueBackMethod · 0.95

Calls 3

maybeReportProgressMethod · 0.95
LockMethod · 0.65
UnlockMethod · 0.65

Tested by

no test coverage detected