Skip to content

Commit

Permalink
add goroutine M test
Browse files Browse the repository at this point in the history
mlycore committed Dec 27, 2017
1 parent 7e28f4c commit f732181
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions goroutine/demo1.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package main
import(
"sync"
"time"
)

import "C"

func main() {
var wg sync.WaitGroup
wg.Add(1000)

for i := 0; i < 1000; i++ {
go func() {
C.sleep(1)
wg.Done()
}()
}

wg.Wait()
println("done!")
time.Sleep(time.Second * 5)
}

0 comments on commit f732181

Please sign in to comment.