Skip to content

linsanzhu/rotinpo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rotinpo

an easy-to-use and efficient go routine pool

Quick Start

package main

import (
    "fmt"

    "github.com/folivora-ice/rotinpo"
)

func main() {
    pool := rotinpo.New(
        WithMaxWorkingSize(50),
        WithMaxIdleSize(10),
        WithMaxLifeTime(10 * time.Second),
        WithMaxWaitingSize(20),
    )
    err := pool.Execute(rotinpo.Task(func() {
        fmt.Println("hello rotinpo")
    }))
    if rotinpo.IsRejected(err) {
        fmt.Println("the task is reject")
    }

    pool.WaitExecute(rotinpo.Task(func() {
        fmt.Println("wait until could be execute or cached")
    }))

    pool.Close()
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages