File tree Expand file tree Collapse file tree 3 files changed +0
-39
lines changed Expand file tree Collapse file tree 3 files changed +0
-39
lines changed Original file line number Diff line number Diff line change @@ -4,13 +4,6 @@ package runtime
4
4
5
5
type timeUnit float64 // time in milliseconds, just like Date.now() in JavaScript
6
6
7
- // wasmNested is used to detect scheduler nesting (WASM calls into JS calls back into WASM).
8
- // When this happens, we need to use a reduced version of the scheduler.
9
- //
10
- // TODO: this variable can probably be removed once //go:wasmexport is the only
11
- // allowed way to export a wasm function (currently, //export also works).
12
- var wasmNested bool
13
-
14
7
var handleEvent func ()
15
8
16
9
//go:linkname setEventHandler syscall/js.setEventHandler
Original file line number Diff line number Diff line change @@ -8,24 +8,10 @@ func resume() {
8
8
handleEvent ()
9
9
}()
10
10
11
- if wasmNested {
12
- minSched ()
13
- return
14
- }
15
-
16
- wasmNested = true
17
11
scheduler (false )
18
- wasmNested = false
19
12
}
20
13
21
14
//export go_scheduler
22
15
func go_scheduler () {
23
- if wasmNested {
24
- minSched ()
25
- return
26
- }
27
-
28
- wasmNested = true
29
16
scheduler (false )
30
- wasmNested = false
31
17
}
Original file line number Diff line number Diff line change @@ -247,24 +247,6 @@ func scheduler(returnAtDeadlock bool) {
247
247
}
248
248
}
249
249
250
- // This horrible hack exists to make WASM work properly.
251
- // When a WASM program calls into JS which calls back into WASM, the event with which we called back in needs to be handled before returning.
252
- // Thus there are two copies of the scheduler running at once.
253
- // This is a reduced version of the scheduler which does not deal with the timer queue (that is a problem for the outer scheduler).
254
- func minSched () {
255
- scheduleLog ("start nested scheduler" )
256
- for ! schedulerDone {
257
- t := runqueue .Pop ()
258
- if t == nil {
259
- break
260
- }
261
-
262
- scheduleLogTask (" run:" , t )
263
- t .Resume ()
264
- }
265
- scheduleLog ("stop nested scheduler" )
266
- }
267
-
268
250
func Gosched () {
269
251
runqueue .Push (task .Current ())
270
252
task .Pause ()
You can’t perform that action at this time.
0 commit comments