File tree Expand file tree Collapse file tree 1 file changed +23
-3
lines changed Expand file tree Collapse file tree 1 file changed +23
-3
lines changed Original file line number Diff line number Diff line change 33package runtime
44
55import (
6+ "sync"
67 "unsafe"
78
89 "internal/wasi/cli/v0.2.0/environment"
@@ -11,12 +12,31 @@ import (
1112
1213type timeUnit int64
1314
14- //export wasi:cli/[email protected] #run 15- func __wasi_cli_run_run () uint32 {
15+ var initialize = sync .OnceFunc (func () {
1616 // These need to be initialized early so that the heap can be initialized.
1717 heapStart = uintptr (unsafe .Pointer (& heapStartSymbol ))
1818 heapEnd = uintptr (wasm_memory_size (0 ) * wasmPageSize )
19- run ()
19+ initHeap ()
20+ initAll ()
21+ })
22+
23+ //export _initialize
24+ func _initialize () {
25+ initialize ()
26+ }
27+
28+ //export wasi:cli/[email protected] #run 29+ func __wasi_cli_run_run () uint32 {
30+ initialize ()
31+ if hasScheduler {
32+ go func () {
33+ callMain ()
34+ schedulerDone = true
35+ }()
36+ scheduler ()
37+ } else {
38+ callMain ()
39+ }
2040 return 0
2141}
2242
You can’t perform that action at this time.
0 commit comments