Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrConsumed = errors.New("future is already consumed")
Functions ¶
func ConsumeCStatusIntoError ¶
Types ¶
type CFuturePtr ¶
type CGOAsyncFunction ¶
type CGOAsyncFunction = func() CFuturePtr
type Future ¶
type Future interface { // BlockAndLeakyGet block until the future is ready or canceled, and return the leaky result. // Caller should only call once for BlockAndLeakyGet, otherwise the ErrConsumed will returned. // Caller will get the merr.ErrSegcoreCancel or merr.ErrSegcoreTimeout respectively if the future is canceled or timeout. // Caller will get other error if the underlying cgo function throws, otherwise caller will get result. // Caller should free the result after used (defined by caller), otherwise the memory of result is leaked. BlockAndLeakyGet() (unsafe.Pointer, error) // Release the resource of the future. // !!! Release is not concurrent safe with other methods. // It should be called only once after all method of future is returned. Release() // contains filtered or unexported methods }
type Opt ¶
type Opt func(*options)
Opt is the option type for future.
func WithReleaser ¶
func WithReleaser(releaser func()) Opt
WithReleaser sets the releaser function. When a future is ready, the releaser function will be called once.
Click to show internal directories.
Click to hide internal directories.