Skip to content

Commit 85958f6

Browse files
authored
add is_finished and fix rustflags (#4)
* implement is_finished * bump versions * fix cargo flags * run cargo fmt * fix ci
1 parent df613ff commit 85958f6

15 files changed

Lines changed: 108 additions & 84 deletions

File tree

.cargo/config.toml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
1-
[build]
2-
target = "wasm32-unknown-unknown"
3-
41
[target.wasm32-unknown-unknown]
5-
rustflags = ["-C", "target-feature=+atomics"]
2+
rustflags = [
3+
"-C", "target-feature=+atomics",
4+
"-Clink-args=--shared-memory",
5+
"-Clink-args=--import-memory",
6+
"-Clink-args=--max-memory=1073741824",
7+
"-Clink-args=--export=__wasm_init_tls",
8+
"-Clink-args=--export=__tls_size",
9+
"-Clink-args=--export=__tls_align",
10+
"-Clink-args=--export=__tls_base",
11+
]
612
# Ciantic: Tested +simd128 22.7.2021, didn't work! Got some wasm-opt problems.
713
# 2024-10-01 - It now works, but threading works without it. So probably best to wait for it to stabilize.
814
# 2025-06-12 - mutable-globals is enabled by default, and bulk-memory is enabled by default on Rust 1.87+
15+
# 2025-10-02 - rust now requires extra -Clink-args to enable shared-memory, see https://github.com/rust-lang/rust/pull/147225
916

1017
[unstable]
1118
build-std = ["panic_abort", "std"]

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
rust: nightly
2121
rust-wasm: true
2222
rust-src: true
23-
tool-cargo-binstall: txtpp
23+
tool-cargo-install: txtpp
2424
- run: task install-ci
2525
working-directory: example
2626
- run: task build

.github/workflows/check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ jobs:
2020
rust: nightly
2121
rust-wasm: true
2222
rust-src: true
23-
tool-cargo-binstall: txtpp
23+
tool-cargo-install: txtpp
2424
- run: task check

Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "wasm-bindgen-spawn"
3-
version = "0.0.2"
3+
version = "0.0.3"
44
edition = "2024"
55
description = "Web Worker Multithreading library for wasm-bindgen the uses shared memory"
66
repository = "https://github.com/Pistonite/wasm-bindgen-spawn"
@@ -20,12 +20,12 @@ include = [
2020
]
2121

2222
[dependencies]
23-
js-sys = "0.3.77"
23+
js-sys = "0.3.83"
2424
oneshot = { version = "0.1.11", default-features = false, features = ["std"] }
2525
static_assertions = "1.1.0"
26-
thiserror = "2.0.12"
27-
wasm-bindgen = "0.2.100"
28-
wasm-bindgen-futures = { version = "0.4.50", optional = true }
26+
thiserror = "2.0.17"
27+
wasm-bindgen = "0.2.106"
28+
wasm-bindgen-futures = { version = "0.4.56", optional = true }
2929

3030
[features]
3131
default = ["async"]

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,16 @@ Read the full article for more details on the implications of Cross-Origin Isola
6161
2. Add the following to `.cargo/config.toml`
6262
```toml
6363
[target.wasm32-unknown-unknown]
64-
rustflags = ["-C", "target-feature=+atomics"]
64+
rustflags = [
65+
"-C", "target-feature=+atomics",
66+
"-Clink-args=--shared-memory",
67+
"-Clink-args=--import-memory",
68+
"-Clink-args=--max-memory=1073741824",
69+
"-Clink-args=--export=__wasm_init_tls",
70+
"-Clink-args=--export=__tls_size",
71+
"-Clink-args=--export=__tls_align",
72+
"-Clink-args=--export=__tls_base",
73+
]
6574
# You also need `bulk-memory` for Rust < 1.87. For 1.87+ it's enabled by default
6675
# rustflags = ["-C", "target-feature=+atomics,+bulk-memory"]
6776

Taskfile.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ includes:
99
cargo:
1010
taskfile: ./mono-dev/task/cargo.yaml
1111
internal: true
12+
optional: true
1213

1314
tasks:
1415
install-cargo-extra-tools:

example/.cargo/config.toml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
11
[target.wasm32-unknown-unknown]
2-
rustflags = ["-C", "target-feature=+atomics,+bulk-memory,+mutable-globals"]
2+
rustflags = [
3+
"-C", "target-feature=+atomics",
4+
"-Clink-args=--shared-memory",
5+
"-Clink-args=--import-memory",
6+
"-Clink-args=--max-memory=1073741824",
7+
"-Clink-args=--export=__wasm_init_tls",
8+
"-Clink-args=--export=__tls_size",
9+
"-Clink-args=--export=__tls_align",
10+
"-Clink-args=--export=__tls_base",
11+
]
312
# Ciantic: Tested +simd128 22.7.2021, didn't work! Got some wasm-opt problems.
4-
# 10.01.2024 - It now works, but threading works without it. So probably best to wait for it to stabilize.
13+
# 2024-10-01 - It now works, but threading works without it. So probably best to wait for it to stabilize.
14+
# 2025-06-12 - mutable-globals is enabled by default, and bulk-memory is enabled by default on Rust 1.87+
15+
# 2025-10-02 - rust now requires extra -Clink-args to enable shared-memory, see https://github.com/rust-lang/rust/pull/147225
516

617
[unstable]
718
build-std = ["panic_abort", "std"]

example/Cargo.lock

Lines changed: 34 additions & 53 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ edition = "2024"
55

66
[dependencies]
77
console_error_panic_hook = "0.1.7"
8-
js-sys = "0.3.77"
9-
wasm-bindgen = "0.2.100"
10-
wasm-bindgen-futures = "0.4.50"
8+
js-sys = "0.3.83"
9+
wasm-bindgen = "0.2.106"
10+
wasm-bindgen-futures = "0.4.56"
1111
wasm-bindgen-spawn = { path = ".." }
1212

1313
[lib]

example/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::{
22
cell::OnceCell,
3-
sync::{atomic::AtomicUsize, Arc, Mutex},
3+
sync::{Arc, Mutex, atomic::AtomicUsize},
44
};
55

66
use js_sys::Function;

0 commit comments

Comments
 (0)