core

package
v0.1.30 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddJob

func AddJob(spec string, cmd func()) error

func Context

func Context() context.Context

Context 获取全局顶层context

func GetContextWithCancel

func GetContextWithCancel() (context.Context, context.CancelFunc)

GetContextWithCancel 创建一个新的可取消上下文

func RegisterHook

func RegisterHook(name string, callback func()) context.Context

RegisterHook 注册系统退出的hook

func Shutdown

func Shutdown()

Shutdown 关闭应用程序, 通知所有协程退出

func WaitForShutdown

func WaitForShutdown(d ...int)

WaitForShutdown 阻塞等待关闭信号

参数d为等待的毫秒数:

  • 如果传入d > 0,等待指定毫秒后关闭
  • 如果传入d == 0或未传参,等待中断信号

Types

This section is empty.

Jump to

Keyboard shortcuts

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