MCPcopy
hub / github.com/cilium/cilium / Stop

Method Stop

pkg/eventqueue/eventqueue.go:264–282  ·  view source on GitHub ↗

Stop stops any further events from being processed by the EventQueue. Any event which is currently being processed by the EventQueue will continue to run. All other events waiting to be processed, and all events that may be enqueued will not be processed by the event queue; they will be cancelled. I

()

Source from the content-addressed store, hash-verified

262// enqueued will not be processed by the event queue; they will be cancelled.
263// If the queue has already been stopped, this is a no-op.
264func (q *EventQueue) Stop() {
265 if q.notSafeToAccess() {
266 return
267 }
268
269 q.closeOnce.Do(func() {
270 q.logger.Debug("stopping EventQueue")
271 // Any event that is sent to the queue at this point will be cancelled
272 // immediately in Enqueue().
273 close(q.drain)
274
275 // Signal that the queue has been drained.
276 close(q.close)
277
278 q.eventsMu.Lock()
279 close(q.events)
280 q.eventsMu.Unlock()
281 })
282}
283
284// WaitToBeDrained returns the channel which waits for the EventQueue to have been
285// stopped. This allows for queuers to ensure that all events in the queue have

Callers 8

TestStopWithoutRunFunction · 0.95
TestDrainedFunction · 0.95
TestDrainFunction · 0.95
TestEnqueueTwiceFunction · 0.95
TestForcefulDrainingFunction · 0.95

Calls 5

notSafeToAccessMethod · 0.95
DebugMethod · 0.65
LockMethod · 0.65
UnlockMethod · 0.65
DoMethod · 0.45

Tested by 8

TestStopWithoutRunFunction · 0.76
TestDrainedFunction · 0.76
TestDrainFunction · 0.76
TestEnqueueTwiceFunction · 0.76
TestForcefulDrainingFunction · 0.76