From 01b0e12ba27b5069248fd09235e9a7143915ee30 Mon Sep 17 00:00:00 2001 From: Irvin Date: Wed, 16 Feb 2022 02:02:49 +0800 Subject: remove `notranslate` class in zh-CN --- .../javascript/reference/global_objects/atomics/notify/index.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'files/zh-cn/web/javascript/reference/global_objects/atomics/notify') diff --git a/files/zh-cn/web/javascript/reference/global_objects/atomics/notify/index.html b/files/zh-cn/web/javascript/reference/global_objects/atomics/notify/index.html index bf2399192c..6459625463 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/atomics/notify/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/atomics/notify/index.html @@ -18,7 +18,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Atomics/notify

语法

-
Atomics.notify(typedArray, index, count)
+
Atomics.notify(typedArray, index, count)
 

参数

@@ -47,18 +47,18 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Atomics/notify

分配一个共享的 Int32Array

-
var sab = new SharedArrayBuffer(1024);
+
var sab = new SharedArrayBuffer(1024);
 var int32 = new Int32Array(sab);
 

一个读线程会进入休眠并监视索引0处的值(默认为0)。只要索引0处的值不为0,读进程就会唤醒。但是,一旦写进程存储了一个新的值,写进程就会产生一个提醒并返回写入后的新值(123)。(这里示例有问题或者说对初学者不友好,如果直接在浏览器控制台运行下面代码会报错,因为我们不能尝试睡眠主线程,可以见 重学js —— 结构化数据之Atomics对象,同时我在 codepen 写了一个示例:Atomics.wait使用示例

-
Atomics.wait(int32, 0, 0);
+
Atomics.wait(int32, 0, 0);
 console.log(int32[0]); // 123

写进程写入一个新值并告知等待进程已经写入成功了:

-
console.log(int32[0]); // 0;
+
console.log(int32[0]); // 0;
 Atomics.store(int32, 0, 123);
 Atomics.notify(int32, 0, 1);
-- cgit v1.2.3-54-g00ecf