corectx

package
v0.4.26 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2026 License: LGPL-2.1 Imports: 4 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UnsafeContext deprecated

func UnsafeContext(ctx Context) _UnsafeContext

Deprecated: UnsafeContext 访问上下文内部方法

Types

type ConcurrentContextProvider

type ConcurrentContextProvider interface {
	// ConcurrentContext 获取多线程安全的上下文
	ConcurrentContext() iface.Cache
}

ConcurrentContextProvider 多线程安全的上下文提供者

type Context

type Context interface {
	context.Context

	// ParentContext 获取父上下文
	ParentContext() context.Context
	// AutoRecover panic时是否自动恢复
	AutoRecover() bool
	// ReportError 在开启panic时自动恢复时,将会恢复并将错误写入此error channel
	ReportError() chan error
	// WaitGroup 获取等待组
	WaitGroup() WaitGroup
	// Terminate 停止
	Terminate() async.AsyncRet
	// Terminated 已停止
	Terminated() async.AsyncRet
	// contains filtered or unexported methods
}

Context 上下文

type ContextBehavior

type ContextBehavior struct {
	context.Context
	// contains filtered or unexported fields
}

ContextBehavior 上下文行为

func (*ContextBehavior) AutoRecover

func (ctx *ContextBehavior) AutoRecover() bool

AutoRecover panic时是否自动恢复

func (*ContextBehavior) ParentContext

func (ctx *ContextBehavior) ParentContext() context.Context

ParentContext 获取父上下文

func (*ContextBehavior) ReportError

func (ctx *ContextBehavior) ReportError() chan error

ReportError 在开启panic时自动恢复时,将会恢复并将错误写入此error channel

func (*ContextBehavior) Terminate

func (ctx *ContextBehavior) Terminate() async.AsyncRet

Terminate 停止

func (*ContextBehavior) Terminated

func (ctx *ContextBehavior) Terminated() async.AsyncRet

Terminated 已停止

func (*ContextBehavior) WaitGroup

func (ctx *ContextBehavior) WaitGroup() WaitGroup

WaitGroup 获取等待组

type CurrentContextProvider

type CurrentContextProvider interface {
	ConcurrentContextProvider
	// CurrentContext 获取当前上下文
	CurrentContext() iface.Cache
}

CurrentContextProvider 当前上下文提供者

type WaitGroup

type WaitGroup interface {
	// Join 添加任务
	Join(delta int64) bool
	// Done 任务完成
	Done()
	// Wait 等待所有任务完成
	Wait()
	// Closed 是否已关闭
	Closed() bool
	// Count 等待任务数量
	Count() int64
}

WaitGroup 等待组

Jump to

Keyboard shortcuts

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