about summary refs log tree commit diff
path: root/library/std/src/sys/pal/wasm
AgeCommit message (Collapse)AuthorLines
2025-01-24Update a bunch of comments from before wasi support was addedbjorn3-1/+1
2024-10-17Abstract the state type for futexesPaul Menage-2/+7
In the same way that we expose SmallAtomic and SmallPrimitive to allow Windows to use a value other than an AtomicU32 for its futex state, this patch switches the primary futex state type from AtomicU32 to futex::Atomic. The futex::Atomic type should be usable as an atomic value with underlying primitive type equal to futex::Primitive. This allows supporting the futex API on systems where the underlying kernel futex implementation requires more state than simply an AtomicU32. All in-tree futex implementations simply define {Atomic,Primitive} directly as {AtomicU32,u32}.
2024-08-27std: move allocators to `sys`joboet-168/+0
2024-07-29Reformat `use` declarations.Nicholas Nethercote-4/+2
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-26Fix doc nitsJohn Arundel-2/+2
Many tiny changes to stdlib doc comments to make them consistent (for example "Returns foo", rather than "Return foo", per RFC1574), adding missing periods, paragraph breaks, backticks for monospace style, and other minor nits. https://github.com/rust-lang/rfcs/blob/master/text/1574-more-api-documentation-conventions.md#appendix-a-full-conventions-text
2024-07-16Use futex.rs for Windows thread parkingChris Denton-0/+5
2024-07-04Rollup merge of #126792 - wooden-worm:master, r=Mark-SimulacrumJacob Pratt-10/+15
wasm64 build with target-feature=+simd128,+atomics Fixes https://github.com/rust-lang/rust/issues/126778
2024-06-23wasm64 build with target-feature=+simd128,+atomicswooden-worm-10/+15
2024-06-15std: refactor the TLS implementationjoboet-4/+0
As discovered by Mara in #110897, our TLS implementation is a total mess. In the past months, I have simplified the actual macros and their expansions, but the majority of the complexity comes from the platform-specific support code needed to create keys and register destructors. In keeping with #117276, I have therefore moved all of the `thread_local_key`/`thread_local_dtor` modules to the `thread_local` module in `sys` and merged them into a new structure, so that future porters of `std` can simply mix-and-match the existing code instead of having to copy the same (bad) implementation everywhere. The new structure should become obvious when looking at `sys/thread_local/mod.rs`. Unfortunately, the documentation changes associated with the refactoring have made this PR rather large. That said, this contains no functional changes except for two small ones: * the key-based destructor fallback now, by virtue of sharing the implementation used by macOS and others, stores its list in a `#[thread_local]` static instead of in the key, eliminating one indirection layer and drastically simplifying its code. * I've switched over ZKVM (tier 3) to use the same implementation as WebAssembly, as the implementation was just a way worse version of that Please let me know if I can make this easier to review! I know these large PRs aren't optimal, but I couldn't think of any good intermediate steps. @rustbot label +A-thread-locals
2024-06-05Raise `DEFAULT_MIN_STACK_SIZE` to at least 64KiBJubilee Young-1/+1
Prevent copy-paste errors from producing new starved-for-resources threaded platforms by raising `DEFAULT_MIN_STACK_SIZE` from 4096 bytes to at least 64KiB. Two platforms "affected" by this have no actual threads: - UEFI - "unsupported" Platforms that this actually affects: - wasm32-wasi with "atomics" enabled - wasm32-wasi-p1-threads Two exceptions: - SGX: a "secure code execution" platform, stays at 4096B - TEEOS: also a "secure code execution" platform, stays at 8192B I believe either of these may have sufficiently "interesting" semantics around threads, or significant external library support. Either would mean making any choices here for them is suspect.
2024-05-02std: move thread parking to `sys::sync`joboet-2/+0
2024-04-05Revert #121666Chris Denton-4/+0
This reverts #121666 due to #123495
2024-03-19SeqCst->{Release,Acquire} for wasm DropLock.Mara Bos-3/+6
SeqCst is unnecessary. Release+Acquire is the right ordering for a mutex.
2024-03-12std: move `Once` implementations to `sys`joboet-2/+0
2024-03-03Add missing get_name for wasm::thread.Ian Neumann-0/+4
2024-02-16std: move locks to `sys` on platforms without threadsjoboet-2/+0
2024-02-16std: move locks to `sys` on UNIX and other futex platformsjoboet-10/+0
2024-02-15Use generic `NonZero` internally.Markus Reiter-2/+2
2024-02-08std: move path into `sys`joboet-2/+0
2024-01-22std: move cmath into `sys`joboet-2/+0
2024-01-15std: move OS String implementation into `sys`joboet-2/+0
2024-01-11std: begin moving platform support modules into `pal`joboet-0/+345