core: v2ray.com/core/common/task Index | Files

package task

import "v2ray.com/core/common/task"

Index

Package Files

common.go periodic.go task.go

func Close Uses

func Close(v interface{}) func() error

Close returns a func() that closes v.

func OnSuccess Uses

func OnSuccess(f func() error, g func() error) func() error

OnSuccess executes g() after f() returns nil.

func Run Uses

func Run(ctx context.Context, tasks ...func() error) error

Run executes a list of tasks in parallel, returns the first error encountered or nil if all tasks pass.

type Periodic Uses

type Periodic struct {
    // Interval of the task being run
    Interval time.Duration
    // Execute is the task function
    Execute func() error
    // contains filtered or unexported fields
}

Periodic is a task that runs periodically.

func (*Periodic) Close Uses

func (t *Periodic) Close() error

Close implements common.Closable.

func (*Periodic) Start Uses

func (t *Periodic) Start() error

Start implements common.Runnable.

Package task imports 5 packages (graph) and is imported by 42 packages. Updated 2019-03-29. Refresh now. Tools for package owners.