LinkSyk / multitask

MultiTask is simple task manager. you can use it to process multiple tasks and receive result from these tasks.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MultiTask

MultiTask is simple task manager. you can use it to process multiple tasks and receive result from these tasks.

Quick start

create two task to count number.

mt := NewMultiTask()

mt.Do(func(ch chan<- interface{}) {
    for i := 0; i < 100; i++ {
        ch <- 1
    }
})
mt.Do(func(ch chan<- interface{}) {
    for i := 0; i < 100; i++ {
        ch <- 1
    }
})

cnt := 0
mt.Fetch(func(result interface{}) {
    cnt += 1
})

mt.Wait()

create two task, not to recv.

mt := NewMultiTask()

mt.Do(func(ch chan<- interface{}) {
    for i := 0; i < 100; i++ {
        // do something
    }
})
mt.Do(func(ch chan<- interface{}) {
    for i := 0; i < 100; i++ {
        // do something
    }
})

mt.Wait()

About

MultiTask is simple task manager. you can use it to process multiple tasks and receive result from these tasks.

License:MIT License


Languages

Language:Go 100.0%