signal

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 24, 2023 License: MIT Imports: 3 Imported by: 1

README

Manual

阻塞主 goroutine

会阻塞主 goroutine 直到接收到 USR1、USR2、INT、TERM、QUIT 其中之一的信号

func Wait() os.Signal

示例

package main

import (
	"fmt"

	"github.com/o8x/jk/signal"
)

func main() {
	signal.Wait()
	
	fmt.Println("app shutdown")
}

阻塞主 goroutine

会阻塞主 goroutine 直到接收到提供的信号

func WaitSignal(s ...os.Signal) os.Signal

示例

package main

import (
	"fmt"
	"syscall"

	"github.com/o8x/jk/signal"
)

func main() {
	signal.WaitSignal(syscall.SIGINT)

	fmt.Println("app shutdown")
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Wait

func Wait() os.Signal

func WaitSignal

func WaitSignal(s ...os.Signal) os.Signal

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL