mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-06 03:53:42 +00:00
runtime: add cap and len support for chans
This commit is contained in:
Vendored
+5
-1
@@ -9,7 +9,11 @@ import (
|
||||
var wg sync.WaitGroup
|
||||
|
||||
func main() {
|
||||
ch := make(chan int)
|
||||
ch := make(chan int, 2)
|
||||
ch <- 1
|
||||
println("len, cap of channel:", len(ch), cap(ch), ch == nil)
|
||||
|
||||
ch = make(chan int)
|
||||
println("len, cap of channel:", len(ch), cap(ch), ch == nil)
|
||||
|
||||
wg.Add(1)
|
||||
|
||||
Vendored
+1
@@ -1,3 +1,4 @@
|
||||
len, cap of channel: 1 2 false
|
||||
len, cap of channel: 0 0 false
|
||||
recv from open channel: 1 true
|
||||
received num: 2
|
||||
|
||||
Reference in New Issue
Block a user