gotask

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

README

gotask

task for go

fmt.Println(_FnCost(func() {
    Debug = false

    _fn := TaskOf(func(i int) {
        //fmt.Println(i)
        _T(i == 90999, "90999 error")
    }, func(err error) {
        _Throw(err)
    })

    var task = NewTask(500, time.Second+time.Millisecond*10)
    for i := 0; i < 100000; i++ {
        if err := task.Do(_fn, i); err != nil {
            fmt.Println(err)
            break
        }
    }

    task.Wait()
}))

Documentation

Index

Constants

View Source
const Version = "v0.0.1"

Variables

View Source
var Debug = true

Functions

func TaskOf

func TaskOf(fn interface{}, efn ...func(err error)) internal.TaskFn

Types

type Task

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

func NewTask

func NewTask(max int, maxDur time.Duration) *Task

func (*Task) Do

func (t *Task) Do(f internal.TaskFn, args ...interface{}) error

func (*Task) Len added in v0.0.2

func (t *Task) Len() int

func (*Task) Wait

func (t *Task) Wait()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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