mirror of https://github.com/tinygo-org/tinygo.git
wasmstm32webassemblymicrocontrollerarmavrspiwasiadafruitarduinocircuitplayground-expressgpioi2cllvmmicrobitnrf51nrf52nrf52840samd21tinygo
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
314 B
25 lines
314 B
package main
|
|
|
|
func chanIntSend(ch chan int) {
|
|
ch <- 3
|
|
}
|
|
|
|
func chanIntRecv(ch chan int) {
|
|
<-ch
|
|
}
|
|
|
|
func chanZeroSend(ch chan struct{}) {
|
|
ch <- struct{}{}
|
|
}
|
|
|
|
func chanZeroRecv(ch chan struct{}) {
|
|
<-ch
|
|
}
|
|
|
|
func selectZeroRecv(ch1 chan int, ch2 chan struct{}) {
|
|
select {
|
|
case ch1 <- 1:
|
|
case <-ch2:
|
|
default:
|
|
}
|
|
}
|
|
|