From: Ian Lance Taylor Date: Tue, 29 Oct 2019 00:55:38 +0000 (-0700) Subject: runtime: clear js idle timeout before new one and after event handler X-Git-Tag: go1.14beta1~495 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=cf6e6abc68fb1d20475bafaa65d9f96b23ae3773;p=gostls13.git runtime: clear js idle timeout before new one and after event handler Updates #6239 Updates #27707 Change-Id: I0a62c1374db485dd830bf02e59625997d9247fc3 Reviewed-on: https://go-review.googlesource.com/c/go/+/203890 Run-TryBot: Ian Lance Taylor TryBot-Result: Gobot Gobot Reviewed-by: Brad Fitzpatrick --- diff --git a/src/runtime/lock_js.go b/src/runtime/lock_js.go index 51cbe60607..df52ea04fd 100644 --- a/src/runtime/lock_js.go +++ b/src/runtime/lock_js.go @@ -158,6 +158,7 @@ var idleID int32 // If an event handler returned, we resume it and it will pause the execution. func beforeIdle(delay int64) bool { if delay > 0 { + clearIdleID() if delay < 1e6 { delay = 1 } else if delay < 1e15 { @@ -229,6 +230,7 @@ func handleEvent() { func handleAsyncEvent() { isHandlingEvent = true eventHandler() + clearIdleID() isHandlingEvent = false }