Created
June 6, 2014 19:25
-
-
Save bolilla/7c158523096ac27b6359 to your computer and use it in GitHub Desktop.
GoPadawan Concurrencia Select Timeout After
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
import "time" | |
func main() { | |
c := make(chan bool) | |
select { | |
case d := <-c: | |
fmt.Println("He leído", d) | |
case <-time.After(time.Second): | |
fmt.Println("Me he cansado de esperar") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment