
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.
24 строки
344 Б
Text
24 строки
344 Б
Text
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
|