Documentation ¶
Overview ¶
Package interrupt provides an interrupt helper.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
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 ¶
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: * r must not be nil. * f must not already be forwarding interrupts to a Receiver.
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.