Skip to content

sbabiv/roundrobin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

roundrobin

Golang round-robin

package main

import (
	"fmt"
	"sync"

	"github.com/sbabiv/roundrobin"
)

func main() {
	source := []interface{}{1, 2, 3}
	b := roundrobin.New(source)
	wc := sync.WaitGroup{}

	for i := 0; i < 1000; i++ {
		wc.Add(1)
		go func() {
			v, _ := b.Pick()
			fmt.Printf("%v\n", v.(int))
			wc.Done()
		}()
	}

	wc.Wait()
}

About

Golang round-robin

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages