Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.33 KB | None | 0 0
  1. recevingChannel := make(chan int, 1)
  2.     sendingChannel := make(chan int, 1)
  3.     sendingValue := 10
  4.     select {
  5.         case recevingValue := <- recevingChannel:
  6.             fmt.Println(recevingValue)
  7.         case sendingChannel <- sendingValue:
  8.             fmt.Println("Value send")
  9.         case <- time.After(time.Second*10):
  10.             fmt.Println("Timeout")
  11.             return
  12.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement