GoLang
xxxxxxxxxx
package main
import (
"fmt"
"time"
)
func main() {
c1 := make(chan string)
c2 := make(chan string)
go func() {
time.Sleep(1 * time.Second)
c1 <- "one"
}()
go func() {
time.Sleep(2 * time.Second)
c2 <- "two"
}()
for i := 0; i < 2; i++ {
select {
case msg1 := <-c1:
fmt.Println("received", msg1)
case msg2 := <-c2:
fmt.Println("received", msg2)
}
}
}
received one received two real 0m2.245s
Linux - Comment installer anc-api-tools
Linux - Comment installer curvedns
Python - Vérifier si un nombre est positif, négatif ou 0
Linux - Comment installer zenmap
C - Compter le nombre de chiffres dans un entier
JavaScript - Vérifier si une chaîne commence et se termine par certains caractères
C++ - Vérifier l'année bissextile
C++ - Vérifier si un nombre est premier ou non
C - Trouver le plus grand nombre à l'aide de l'allocation de mémoire dynamique
Kotlin - Arrondir un nombre à n décimales
Kotlin - Inverser un nombre
Linux - Comment installer xbitmaps
Linux - Comment installer zstd
Linux - Comment installer zfs-test
Kotlin - Trouver la factorielle d'un nombre
Java - Inverser un nombre
Kotlin - Calculer la somme des nombres naturels
Kotlin - Compter le nombre de chiffres dans un entier
We have been online since 2021 and 1 millions of people around the globe have visited our website since then
More visitors every month