From 6ef1fa4618e08426b874529619a66adbd3d1fcf0 Mon Sep 17 00:00:00 2001 From: Florian Merz Date: Thu, 11 Feb 2021 12:07:59 +0100 Subject: unslug ja: move --- .../global_objects/atomics/notify/index.html | 142 +++++++++++++++++++++ 1 file changed, 142 insertions(+) create mode 100644 files/ja/web/javascript/reference/global_objects/atomics/notify/index.html (limited to 'files/ja/web/javascript/reference/global_objects/atomics/notify/index.html') diff --git a/files/ja/web/javascript/reference/global_objects/atomics/notify/index.html b/files/ja/web/javascript/reference/global_objects/atomics/notify/index.html new file mode 100644 index 0000000000..be17a5f891 --- /dev/null +++ b/files/ja/web/javascript/reference/global_objects/atomics/notify/index.html @@ -0,0 +1,142 @@ +--- +title: Atomics.wake() +slug: Web/JavaScript/Reference/Global_Objects/Atomics/wake +translation_of: Web/JavaScript/Reference/Global_Objects/Atomics/notify +--- +
{{JSRef}} {{SeeCompatTable}}
+ +

静的メソッドである Atomics.wake() は待ち行列中のいくつかのエージェントを起こします。

+ +
+

付記:この操作は共有された {{jsxref("Int32Array")}} に対してのみ許可されています。

+
+ +

構文

+ +
Atomics.wake(typedArray, index, count)
+
+ +

引数

+ +
+
typedArray
+
共有された {{jsxref("Int32Array")}}。
+
index
+
起こす対象となる typedArray 中の位置。
+
count
+
起こすエージェントの数。既定値は {{jsxref("Infinity", "+Infinity")}} である。
+
+ +

返り値

+ +

起きたエージェントの数。

+ +

例外

+ + + +

+ +

共有された Int32Array を用意します:

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

読み手のスレッドは、0 番目の値が 0 であることを期待してスリープします。それが満たされている間、この場合は 0 番目の値が 0 である間は処理が進みません。しかし書き手のスレッドが新しい値 (この場合は 123)をストアした場合、読み手のスレッドは読み手のスレッドによって起こされ、新しい値 (123)を取得します。

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

書き手のスレッドは新しい値をストアし、待っているスレッドを起こします:

+ +
console.log(int32[0]); // 0;
+Atomics.store(int32, 0, 123);
+Atomics.wake(int32, 0, 1);
+ +

仕様

+ + + + + + + + + + + + + + +
仕様状態コメント
{{SpecName('Shared Memory', '#Atomics.wake', 'Atomics.wake')}}{{Spec2('Shared Memory')}}初期定義
+ +

ブラウザ互換性

+ +

{{CompatibilityTable}}

+ +
+ + + + + + + + + + + + + + + + + + + + + +
FeatureChromeEdgeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support{{CompatNo}} [2]{{CompatNo}}{{CompatGeckoDesktop("46")}} [1] [3]{{CompatNo}}{{CompatNo}}{{CompatNo}}
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
FeatureAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support{{CompatNo}}{{CompatNo}}{{CompatGeckoMobile("46")}} [1]{{CompatNo}}{{CompatNo}}{{CompatNo}}
+
+ +

[1] 設定で無効になっています。about:config で javascript.options.shared_memorytrue に設定することで利用できます。

+ +

[2] 現在実装中で、利用には次のオプションをつけて起動する必要があります:--js-flags=--harmony-sharedarraybuffer --enable-blink-feature=SharedArrayBuffer

+ +

[3] バージョン 46 と 47 では Atomics.futexWake() という名前で利用できます。また引数 count の既定値は 0 となっています。列の代わりに Atomics.OK、Atomics.TIMEDOUT、Atomics.NOTEQUAL を返します

+ +

関連情報

+ + -- cgit v1.2.3-54-g00ecf