Documentation
¶
Index ¶
- Variables
- func MakeAsyncRet() chan Ret
- func MakeAsyncRetT[T any]() chan RetT[T]
- func Return(asyncRet chan Ret, ret Ret) chan Ret
- func ReturnT[T any](asyncRet chan RetT[T], ret RetT[T]) chan RetT[T]
- func YieldBreak(asyncRet chan Ret)
- func YieldBreakT[T any](asyncRet chan RetT[T])
- func YieldReturn(ctx context.Context, asyncRet chan Ret, ret Ret) bool
- func YieldReturnT[T any](ctx context.Context, asyncRet chan RetT[T], ret RetT[T]) bool
- type AsyncRet
- type AsyncRetT
- type Callee
- type Caller
- type Ret
- type RetT
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrAsyncRetClosed = fmt.Errorf("%w: async result closed", exception.ErrCore)
)
View Source
var (
VoidRet = MakeRet(nil, nil) // 空返回值
)
Functions ¶
func YieldBreakT ¶ added in v0.3.97
YieldBreakT 结束产出异步调用结果
func YieldReturn ¶ added in v0.3.97
YieldReturn 产出异步调用结果
Types ¶
type Callee ¶
type Callee interface {
// PushCallAsync 将调用函数压入接受者的任务处理流水线,返回AsyncRet。
PushCallAsync(fun generic.FuncVar0[any, Ret], args ...any) AsyncRet
// PushCallDelegateAsync 将调用委托压入接受者的任务处理流水线,返回AsyncRet。
PushCallDelegateAsync(fun generic.DelegateVar0[any, Ret], args ...any) AsyncRet
// PushCallVoidAsync 将调用函数压入接受者的任务处理流水线,返回AsyncRet。
PushCallVoidAsync(fun generic.ActionVar0[any], args ...any) AsyncRet
// PushCallDelegateVoidAsync 将调用委托压入接受者的任务处理流水线,返回AsyncRet。
PushCallDelegateVoidAsync(fun generic.DelegateVoidVar0[any], args ...any) AsyncRet
}
Callee 异步调用接受者
type Caller ¶
type Caller interface {
// CallAsync 异步调用函数,有返回值。不会阻塞当前线程,会返回AsyncRet。
//
// 注意:
// - 代码片段中的线程安全问题,如临界区访问、线程死锁等。
// - 调用过程中的panic信息,均会转换为error返回。
CallAsync(fun generic.FuncVar0[any, Ret], args ...any) AsyncRet
// CallDelegateAsync 异步调用委托,有返回值。不会阻塞当前线程,会返回AsyncRet。
//
// 注意:
// - 代码片段中的线程安全问题,如临界区访问、线程死锁等。
// - 调用过程中的panic信息,均会转换为error返回。
CallDelegateAsync(fun generic.DelegateVar0[any, Ret], args ...any) AsyncRet
// CallVoidAsync 异步调用函数,无返回值。在运行时中。不会阻塞当前线程,会返回AsyncRet。
//
// 注意:
// - 代码片段中的线程安全问题,如临界区访问、线程死锁等。
// - 调用过程中的panic信息,均会转换为error返回。
CallVoidAsync(fun generic.ActionVar0[any], args ...any) AsyncRet
// CallDelegateVoidAsync 异步调用委托,无返回值。在运行时中。不会阻塞当前线程,会返回AsyncRet。
//
// 注意:
// - 代码片段中的线程安全问题,如临界区访问、线程死锁等。
// - 调用过程中的panic信息,均会转换为error返回。
CallDelegateVoidAsync(fun generic.DelegateVoidVar0[any], args ...any) AsyncRet
}
Caller 异步调用发起者
Click to show internal directories.
Click to hide internal directories.