From e083dc6307b6593bdd44b219ffd21699d6f17fd7 Mon Sep 17 00:00:00 2001 From: Richard Musiol Date: Sun, 20 May 2018 00:56:36 +0200 Subject: runtime, sycall/js: add support for callbacks from JavaScript This commit adds support for JavaScript callbacks back into WebAssembly. This is experimental API, just like the rest of the syscall/js package. The time package now also uses this mechanism to properly support timers without resorting to a busy loop. JavaScript code can call into the same entry point multiple times. The new RUN register is used to keep track of the program's run state. Possible values are: starting, running, paused and exited. If no goroutine is ready any more, the scheduler can put the program into the "paused" state and the WebAssembly code will stop running. When a callback occurs, the JavaScript code puts the callback data into a queue and then calls into WebAssembly to allow the Go code to continue running. Updates #18892 Updates #25506 Change-Id: Ib8701cfa0536d10d69bd541c85b0e2a754eb54fb Reviewed-on: https://go-review.googlesource.com/114197 Reviewed-by: Austin Clements Reviewed-by: Brad Fitzpatrick --- src/cmd/trace/annotations.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/cmd/trace/annotations.go') diff --git a/src/cmd/trace/annotations.go b/src/cmd/trace/annotations.go index c91f18ef6f..96c109e0f2 100644 --- a/src/cmd/trace/annotations.go +++ b/src/cmd/trace/annotations.go @@ -1,3 +1,7 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + package main import ( -- cgit v1.3-5-g9baa