sys

package
v0.0.39 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2025 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnableLocalTraceId added in v0.0.36

func EnableLocalTraceId(supplier Supplier[string])

EnableLocalTraceId 激活TraceIdLocal处理器 如果不指定supplier则使用默认策略 uuid

func GetGoroutineId added in v0.0.36

func GetGoroutineId() int64

GetGoroutineId 获取当前协程id

func GetLocalTraceId added in v0.0.36

func GetLocalTraceId() string

GetLocalTraceId 获取当前线程的TraceId

func IsEnabledLocalTraceId added in v0.0.36

func IsEnabledLocalTraceId() bool

IsEnabledLocalTraceId 判断是否启用了TraceIdLocal处理器

func ShutdownCallback

func ShutdownCallback(f func(), sig ...os.Signal)

ShutdownCallback 监听指定的信号,若不传递则使用默认信号 方法会一直阻塞直到触发所监听的信号为止,并执行回调

func ShutdownCallbackDeadline

func ShutdownCallbackDeadline(f func(), deadline time.Duration, sig ...os.Signal)

ShutdownCallbackDeadline 监听指定的信号,若不传递则使用默认信号 方法会一直阻塞直到触发所监听的信号为止 并执行回调 若在指定时间未完成回调执行,则放弃等待

func ShutdownHolding

func ShutdownHolding(sig ...os.Signal)

ShutdownHolding 监听指定的信号,若不传递则使用默认信号 方法会一直阻塞直到触发所监听的信号为止

Types

type Local added in v0.0.36

type Local[T any] struct {
	// contains filtered or unexported fields
}

Local ThreadLocalStorage 线程本地存储

func NewThreadLocal added in v0.0.36

func NewThreadLocal[T any](supplier ...Supplier[T]) *Local[T]

NewThreadLocal 创建线程本地存储

func (*Local[T]) Delete added in v0.0.36

func (l *Local[T]) Delete()

Delete 删除值

func (*Local[T]) Get added in v0.0.36

func (l *Local[T]) Get() T

Get 获取值

func (*Local[T]) Set added in v0.0.36

func (l *Local[T]) Set(value T)

Set 设置值

type Supplier added in v0.0.36

type Supplier[T any] func() T

Supplier 创建初始化值的提供者

Jump to

Keyboard shortcuts

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