Categorygithub.com/hslam/scheduler
modulepackage
0.0.0-20211028175315-641598104976
Repository: https://github.com/hslam/scheduler.git
Documentation: pkg.go.dev

# README

scheduler

PkgGoDev Build Status codecov Go Report Card LICENSE

Package scheduler implements a task scheduler.

Get started

Install

go get github.com/hslam/scheduler

Import

import "github.com/hslam/scheduler"

Usage

Example

package main

import (
	"github.com/hslam/scheduler"
	"sync"
)

func main() {
	s := scheduler.New(64, nil)
	wg := &sync.WaitGroup{}
	for i := 0; i < 100000; i++ {
		wg.Add(1)
		task := func() {
			wg.Done()
		}
		s.Schedule(task)
	}
	wg.Wait()
	s.Close()
}

License

This package is licensed under a MIT license (Copyright (c) 2021 Meng Huang)

Author

scheduler was written by Meng Huang.

# Functions

DefaultOptions returns default options.
New returns a new task scheduler.
Schedule schedules the task to an idle worker.

# Constants

Unlimited represents the unlimited number of goroutines.

# Structs

Options represents options.

# Interfaces

Scheduler represents a task scheduler.