mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-12 06:53:40 +00:00
wasm: don't block //go:wasmexport because of running goroutines
This fixes bug https://github.com/tinygo-org/tinygo/issues/4874.
This commit is contained in:
committed by
Ron Evans
parent
0c2ab895b7
commit
612a38e363
Vendored
+16
-1
@@ -1,6 +1,9 @@
|
||||
package main
|
||||
|
||||
import "time"
|
||||
import (
|
||||
"runtime"
|
||||
"time"
|
||||
)
|
||||
|
||||
func init() {
|
||||
println("called init")
|
||||
@@ -50,3 +53,15 @@ func reentrantCall(a, b int32) int32 {
|
||||
println("reentrantCall result:", result)
|
||||
return result
|
||||
}
|
||||
|
||||
// Test for bug: https://github.com/tinygo-org/tinygo/issues/4874
|
||||
//
|
||||
//go:wasmexport goroutineExit
|
||||
func goroutineExit() {
|
||||
go func() {
|
||||
time.Sleep(time.Second * 10)
|
||||
println("goroutineExit: exiting goroutine")
|
||||
}()
|
||||
runtime.Gosched()
|
||||
println("goroutineExit: exit")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user