Skip to content

Commit 4bf8a4f

Browse files
authored
Update threading.md
1 parent 1509d4f commit 4bf8a4f

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

threading.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22

33
ECMAScript needs real threading where any function can be spawned as a thread to run asynchronously. Most value type data should be accessible across threads with some operations being atomic automatically. The syntax for creating and managing threads should be very minimal and effortless to use.
44

5-
For example, you should be able to define a global ```a:uint32``` and in a thread ```Atomics.add(a, 5)``` it without shuffling it into a typed array.
5+
For example, you should be able to define a global ```a: uint32``` and in a thread ```Atomics.add(a, 5)``` it without shuffling it into a typed array.
66

77
```js
8-
let a:uint32 = 0;
8+
let a: uint32 = 0;
99
function A() {
10-
Atomics.add(a, 5);
10+
Atomics.add(a, 5);
1111
}
1212
async function B() {
13-
A();
14-
Atomics.add(a, 5);
13+
A();
14+
Atomics.add(a, 5);
1515
}
1616
// Naive call syntax to show these execute on their own thread and callThread returns a promise.
1717
await Promise.all([A.callThread(), B.callThread()]); // Join
@@ -24,11 +24,11 @@ It was my hope that a Cancelable Promise proposal would have been finalized by n
2424

2525
Some value type operations would be atomic automatically. Addition on integers for instance.
2626
```js
27-
let a:uint32 = 0;
27+
let a: uint32 = 0;
2828
function A() {
29-
while (true) {
30-
a += 5;
31-
}
29+
while (true) {
30+
a += 5;
31+
}
3232
}
3333
A.callThread();
3434
await new Promise(resolve => setTimeout(resolve, 100));

0 commit comments

Comments
 (0)