mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-03 02:27:48 +00:00
ad7297a539
Implement two trivial uses of the select statement.
Always blocking:
select {}
No-op:
select {
default:
}
Go 1.12 added a `select {}` instruction to syscall/js, so this is needed
for Go 1.12 support. More complete support for select will be added in
the future.
25 lines
344 B
Plaintext
25 lines
344 B
Plaintext
len, cap of channel: 0 0
|
|
recv from open channel: 1 true
|
|
received num: 2
|
|
received num: 3
|
|
slept
|
|
received num: 4
|
|
received num: 5
|
|
received num: 6
|
|
received num: 7
|
|
received num: 8
|
|
recv from closed channel: 0 false
|
|
got n: 10
|
|
got n: 11
|
|
got n: 10
|
|
got n: 11
|
|
got n: 10
|
|
got n: 11
|
|
sum: 25
|
|
sum: 29
|
|
sum: 33
|
|
sum(100): 4950
|
|
deadlocking
|
|
select no-op
|
|
after no-op
|