once

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2022 License: MIT Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Once

type Once struct {
	Handler func()

	sync.Mutex
	// contains filtered or unexported fields
}

func (*Once) Reset

func (o *Once) Reset()

Reset will rearm Wait()

func (*Once) Trigger

func (o *Once) Trigger()

Trigger will start executing the handler function

func (*Once) Wait

func (o *Once) Wait(ctx context.Context) error

Wait waits for the handler function to complete. If the function is not running it will be triggered. If the function is being executed the first time after Reset(), all callers will block in Wait, until it is completed.

Jump to

Keyboard shortcuts

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