runtime

package
v0.4.1-0...-f267a5f Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2015 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register()

func Until

func Until(f func(), period time.Duration, stopCh <-chan struct{})

periodically execute the given function, stopping once stopCh is closed. this func blocks until stopCh is closed, it's intended to be run as a goroutine.

Types

type Latch

type Latch struct {
	// contains filtered or unexported fields
}

func (*Latch) Acquire

func (self *Latch) Acquire() bool

return true if this latch was successfully acquired. concurrency safe. will only return true upon the first invocation, all subsequent invocations will return false. always returns false when self is nil.

type Signal

type Signal <-chan struct{}

func Go

func Go(f func()) Signal

spawn a goroutine to execute a func, immediately returns a chan that closes upon completion of the func. returns a nil signal chan if the given func is nil.

func On

func On(sig <-chan struct{}, f func()) Signal

execute a callback function after the specified signal chan closes. immediately returns a signal that indicates f's completion.

func OnOSSignal

func OnOSSignal(sig <-chan os.Signal, f func(os.Signal)) Signal

func (Signal) Then

func (sig Signal) Then(f func()) Signal

upon receiving signal sig invoke function f and immediately return a signal that indicates f's completion. used to chain handler funcs, for example:

On(job.Done(), response.Send).Then(wg.Done)

Jump to

Keyboard shortcuts

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