Skip to content

Instantly share code, notes, and snippets.

View vagra's full-sized avatar

Yan Chen vagra

  • CHINA
  • 12:12 (UTC +08:00)
View GitHub Profile
@vagra
vagra / routines.go
Last active February 10, 2023 08:47
mutiple goroutines: main -> an inputer -> many worker -> an outputer -> main.
package main
import (
"context"
"fmt"
"sync"
"time"
)
func worker(wg *sync.WaitGroup, ctx context.Context, i int, ci <-chan int, co chan<- string) {