//go:build tinygo // Package sigtrap nudges TinyGo's cooperative scheduler to process pending // signals. // // On Linux, TinyGo's os/signal handler records a signal but the scheduler only // drains that record when it enters an idle wait. A relay almost always has a // socket parked in netpoll, so the scheduler never reaches that path and // SIGTERM would sit unprocessed until the next unrelated timer wakeup -- or // never. Calling the runtime's checkSignals from a periodic goroutine closes // that gap. package sigtrap import _ "unsafe" //go:linkname checkSignals runtime.checkSignals func checkSignals() bool // Trap asks the runtime to hand any pending signal to os/signal. func Trap() { checkSignals() }