MCPcopy Index your code
hub / github.com/containers/toolbox / watchContextForEventFD

Function watchContextForEventFD

src/cmd/utils.go:545–569  ·  view source on GitHub ↗
(ctx context.Context, eventFD int)

Source from the content-addressed store, hash-verified

543}
544
545func watchContextForEventFD(ctx context.Context, eventFD int) {
546 done := ctx.Done()
547 if done == nil {
548 return
549 }
550
551 if eventFD < 0 {
552 panic("invalid file descriptor for eventfd")
553 }
554
555 go func() {
556 defer unix.Close(eventFD)
557
558 select {
559 case <-done:
560 buffer := make([]byte, 8)
561 binary.PutUvarint(buffer, 1)
562
563 if _, err := unix.Write(eventFD, buffer); err != nil {
564 panicMsg := fmt.Sprintf("write(2) to eventfd failed: %s", err)
565 panic(panicMsg)
566 }
567 }
568 }()
569}

Callers 2

askForConfirmationAsyncFunction · 0.85
discardInputAsyncFunction · 0.85

Calls 1

WriteMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…