Documentation ¶
Overview ¶
包grpool实现了goroutine可复用池。
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddWithRecover ¶
func AddWithRecover(ctx context.Context, userFunc Func, recoverFunc RecoverFunc) error
AddWithRecover 将带有指定恢复函数的新任务推送到默认工作池。
可选的 `recoverFunc` 参数在执行 `userFunc` 函数期间发生任何 panic 时被调用。 如果未传递或给定 nil,则忽略来自 `userFunc` 的 panic。 该任务将被异步执行。
Types ¶
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
Pool 通过使用 goroutine 池来管理 goroutines。
func (*Pool) AddWithRecover ¶
AddWithRecover 向池中添加一个带有指定恢复函数的新任务。
可选的 `recoverFunc` 参数会在执行 `userFunc` 函数期间发生 panic 时被调用。 如果未传递 `recoverFunc` 或其值为 nil,则会忽略来自 `userFunc` 的 panic。 该任务将被异步执行。
type RecoverFunc ¶
RecoverFunc 是包含上下文参数的运行时 panic 恢复函数,用于池化组件。
Click to show internal directories.
Click to hide internal directories.