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
44
55type  timeUnit  float64  // time in milliseconds, just like Date.now() in JavaScript 
66
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- 
147var  handleEvent  func ()
158
169//go:linkname setEventHandler syscall/js.setEventHandler 
Original file line number Diff line number Diff line change @@ -8,24 +8,10 @@ func resume() {
88		handleEvent ()
99	}()
1010
11- 	if  wasmNested  {
12- 		minSched ()
13- 		return 
14- 	}
15- 
16- 	wasmNested  =  true 
1711	scheduler (false )
18- 	wasmNested  =  false 
1912}
2013
2114//export go_scheduler 
2215func  go_scheduler () {
23- 	if  wasmNested  {
24- 		minSched ()
25- 		return 
26- 	}
27- 
28- 	wasmNested  =  true 
2916	scheduler (false )
30- 	wasmNested  =  false 
3117}
Original file line number Diff line number Diff line change @@ -247,24 +247,6 @@ func scheduler(returnAtDeadlock bool) {
247247	}
248248}
249249
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- 
268250func  Gosched () {
269251	runqueue .Push (task .Current ())
270252	task .Pause ()
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments