chans

package
v0.0.0-...-c6a0258 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2025 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AfterChan

func AfterChan[T any](ch <-chan T, fn func(), cancelable ...bool) (cancel func())

AfterChan will invoke fn when ch done, but cancel when ctx done or invoke cancel function

func AfterChanWithContext

func AfterChanWithContext[T any](ctx context.Context, ch <-chan T, fn func(), cancelable ...bool) (cancel func())

AfterChanWithContext will invoke fn when ch done, but cancel when ctx done or invoke cancel function

func AfterContext

func AfterContext(ctx context.Context, fn func(), cancelable ...bool) (cancel func())

AfterContext will invoke fn when ctx done, but cancel when invoke cancel function

func AfterTime

func AfterTime(d time.Duration, fn func(), cancelable ...bool) (cancel func())

AfterTime will invoke fn after d, but cancel when ctx done or invoke cancel function

func AfterTimeWithContext

func AfterTimeWithContext(ctx context.Context, d time.Duration, fn func(), cancelable ...bool) (cancel func())

AfterTime will invoke fn after d, but cancel when ctx done or invoke cancel function

func MakeChan

func MakeChan[T any](size ...int) (ch chan T, closech func())

MakeChan make a channel with type T, The channel's buffer is initialized with the specified buffer capacity. If zero, or the size is omitted, the channel is unbuffered.

func Sleep

func Sleep(ctx context.Context, d time.Duration) (r bool)

Sleep sleeps for the specified duration. It returns false if the context is canceled.

func StructChan

func StructChan(size ...int) (ch chan struct{}, closech func())

StructChan make a unbuffered struct{} channel

Types

This section is empty.

Jump to

Keyboard shortcuts

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