Goroutines and loop together in Golang

Member

lou_lindgren

by lou_lindgren , in category: Golang , 13 days ago

Goroutines and loop together in Golang 🥰

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
for i := 0; i < fanout; i++ {
	go func() {
		for {
			c.Dec(19)
			time.Sleep(300e6)
		}
	}()
	go func() {
		for {
			c.Inc(47)
			time.Sleep(400e6)
		}
	}()
}


Facebook Twitter LinkedIn Telegram Whatsapp Pocket

no answers