MCPcopy
hub / github.com/segmentio/kafka-go / close

Method close

consumergroup.go:344–360  ·  view source on GitHub ↗

close stops the generation and waits for all functions launched via Start to terminate.

()

Source from the content-addressed store, hash-verified

342// close stops the generation and waits for all functions launched via Start to
343// terminate.
344func (g *Generation) close() {
345 g.lock.Lock()
346 if !g.closed {
347 close(g.done)
348 g.closed = true
349 }
350 // determine whether any go routines are running that we need to wait for.
351 // waiting needs to happen outside of the critical section.
352 r := g.routines
353 g.lock.Unlock()
354
355 // NOTE: r will be zero if no go routines were ever launched. no need to
356 // wait in that case.
357 if r > 0 {
358 <-g.joined
359 }
360}
361
362// Start launches the provided function in a go routine and adds accounting such
363// that when the function exits, it stops the current generation (if not

Calls

no outgoing calls