Skip to content

lazaroMB/workqueue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WorkQueue library

Library that provides a mechanism for managing and distributing a collection of work items among worker threads for processing. The library provides an API for adding work items to a queue, starting and stopping worker threads, and querying the state of the queue.

check doc in https://pkg.go.dev/github.com/lazaroMB/workqueue

Usage example

type Process struct {
    delay time.Duration
}

func (p *Process) Exec() {
    time.Sleep(delay time.Second)
}

queue := New[*Process](5) // 5 workers

go queue.StartWorker()

queue.AddWork(&Process{delay: 10})

Releases

No releases published

Packages

No packages published

Languages