diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2019-07-19 12:02:34 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2019-07-25 11:17:07 -0700 |
| commit | dc50a633f3260a3aeb79a4ca9800587be7f732e7 (patch) | |
| tree | ca574585e42fc3c93a931f306e19fa2f95a3b7f9 /src/libstd/sys/wasm/fast_thread_local.rs | |
| parent | a120caf8b4f8e77168378e6ad2b85d077baaa27b (diff) | |
| download | rust-dc50a633f3260a3aeb79a4ca9800587be7f732e7.tar.gz rust-dc50a633f3260a3aeb79a4ca9800587be7f732e7.zip | |
std: Use native `#[thread_local]` TLS on wasm
This commit moves `thread_local!` on WebAssembly targets to using the `#[thread_local]` attribute in LLVM. This was recently implemented upstream and is [in the process of being documented][dox]. This change only takes affect if modules are compiled with `+atomics` which is currently unstable and a pretty esoteric method of compiling wasm artifacts. This "new power" of the wasm toolchain means that the old `wasm-bindgen-threads` feature of the standard library can be removed since it should now be possible to create a fully functioning threaded wasm module without intrusively dealing with libstd symbols or intrinsics. Yay! [dox]: https://github.com/WebAssembly/tool-conventions/pull/116
Diffstat (limited to 'src/libstd/sys/wasm/fast_thread_local.rs')
| -rw-r--r-- | src/libstd/sys/wasm/fast_thread_local.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libstd/sys/wasm/fast_thread_local.rs b/src/libstd/sys/wasm/fast_thread_local.rs new file mode 100644 index 00000000000..ff2198175f0 --- /dev/null +++ b/src/libstd/sys/wasm/fast_thread_local.rs @@ -0,0 +1,9 @@ +#![unstable(feature = "thread_local_internals", issue = "0")] + +pub unsafe fn register_dtor(_t: *mut u8, _dtor: unsafe extern fn(*mut u8)) { + // FIXME: right now there is no concept of "thread exit", but this is likely + // going to show up at some point in the form of an exported symbol that the + // wasm runtime is oging to be expected to call. For now we basically just + // ignore the arguments, but if such a function starts to exist it will + // likely look like the OSX implementation in `unix/fast_thread_local.rs` +} |
