]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: clear js idle timeout before new one and after event handler
authorIan Lance Taylor <iant@golang.org>
Tue, 29 Oct 2019 00:55:38 +0000 (17:55 -0700)
committerIan Lance Taylor <iant@golang.org>
Wed, 30 Oct 2019 16:37:41 +0000 (16:37 +0000)
Updates #6239
Updates #27707

Change-Id: I0a62c1374db485dd830bf02e59625997d9247fc3
Reviewed-on: https://go-review.googlesource.com/c/go/+/203890
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/runtime/lock_js.go

index 51cbe606071562bd328ac7644614aa81fea043fd..df52ea04fd24893df997d5b2b1b415ca9f54e066 100644 (file)
@@ -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
 }