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

package task

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


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). Updated 2019-02-11. Refresh now. Tools for package owners.