gvisorgvisor.dev/gvisor/pkg/sentry/platform/interrupt Index | Files

package interrupt

import "gvisor.dev/gvisor/pkg/sentry/platform/interrupt"

Package interrupt provides an interrupt helper.

Index

Types

type Forwarder

type Forwarder struct {
	// contains filtered or unexported fields
}

Forwarder is a helper for delivering delayed signal interruptions.

This helps platform implementations with Interrupt semantics.

func (*Forwarder) Disable

func (f *Forwarder) Disable()

Disable stops interrupt forwarding. If interrupt forwarding is already disabled, Disable is a no-op.

func (*Forwarder) Enable

func (f *Forwarder) Enable(r Receiver) bool

Enable attempts to enable interrupt forwarding to r. If f has already received an interrupt, Enable does nothing and returns false. Otherwise, future calls to f.NotifyInterrupt() cause r.NotifyInterrupt() to be called, and Enable returns true.

Usage:

if !f.Enable(r) {
	// There was an interrupt.
	return
}

defer f.Disable()

Preconditions:

func (*Forwarder) NotifyInterrupt

func (f *Forwarder) NotifyInterrupt()

NotifyInterrupt implements Receiver.NotifyInterrupt. If interrupt forwarding is enabled, the configured Receiver will be notified. Otherwise the interrupt will be delivered to the next call to Enable.

type Receiver

type Receiver interface {
	// NotifyInterrupt is called when the Receiver receives an interrupt.
	NotifyInterrupt()
}

Receiver receives interrupt notifications from a Forwarder.

Source Files

interrupt.go

Version
v0.0.0-20250605235530-a6711d1e1dc6 (latest)
Published
Jun 5, 2025
Platform
linux/amd64
Imports
2 packages
Last checked
4 hours ago

Tools for package owners.