Documentation
¶
Index ¶
Constants ¶
View Source
const (
// DefaultLimit is the default concurrency limit
DefaultLimit = 100
)
Variables ¶
This section is empty.
Functions ¶
func FindAllGroups ¶ added in v0.24.1
FindAllGroups FindAllGroups example: Pack(?P<DeviceID>\d{1,})(_S(?P<SlaveID>\d{1,})_C(?P<CellID>\d{1,}))?
func InsertSortFindIndex ¶ added in v0.22.3
Inserts a float into a slice, sorts the slice and returns the index of first appearance of given float after sorting
Types ¶
type ConcurrencyLimiter ¶ added in v0.12.0
type ConcurrencyLimiter struct {
// contains filtered or unexported fields
}
ConcurrencyLimiter object
func NewConcurrencyLimiter ¶ added in v0.12.0
func NewConcurrencyLimiter(limit int) *ConcurrencyLimiter
NewConcurrencyLimiter allocates a new ConcurrencyLimiter
func (*ConcurrencyLimiter) Execute ¶ added in v0.12.0
func (c *ConcurrencyLimiter) Execute(job func())
Execute adds a function to the execution queue. if num of go routines allocated by this instance is < limit launch a new go routine to execute job else wait until a go routine becomes available
func (*ConcurrencyLimiter) ExecuteIndex ¶ added in v0.12.0
func (c *ConcurrencyLimiter) ExecuteIndex(index int, job func(numb int))
ExecuteIndex ExecuteIndex
func (*ConcurrencyLimiter) Loop ¶ added in v0.12.0
func (c *ConcurrencyLimiter) Loop(n int, job func(o int))
func (*ConcurrencyLimiter) Wait ¶ added in v0.12.0
func (c *ConcurrencyLimiter) Wait()
Wait will block all the previously Executed jobs completed running.
IMPORTANT: calling the Wait function while keep calling Execute leads to
un-desired race conditions
Click to show internal directories.
Click to hide internal directories.