aboutsummaryrefslogtreecommitdiff
path: root/lib/std/Thread.zig
AgeCommit message (Collapse)Author
2024-11-02std.os.windows: Fix some incorrect callconv specifiers.Alex Rønne Petersen
Closes #21869.
2024-10-29remove unnecessary castJonathanHallstrom
2024-10-16std.Thread: Use loongarch freeAndExit() implementation for loongarch32 too.Alex Rønne Petersen
2024-09-26move std.time.sleep to std.Thread.sleepAndrew Kelley
2024-09-07std: Fix assembler comment syntax for sparc.Alex Rønne Petersen
2024-08-28std: update `std.builtin.Type` fields to follow naming conventionsmlugg
The compiler actually doesn't need any functional changes for this: Sema does reification based on the tag indices of `std.builtin.Type` already! So, no zig1.wasm update is necessary. This change is necessary to disallow name clashes between fields and decls on a type, which is a prerequisite of #9938.
2024-08-19std.Thread: Implement freeAndExit() for hexagon.Alex Rønne Petersen
2024-08-19std.Thread: Implement freeAndExit() for s390x.Alex Rønne Petersen
2024-08-19std.Thread: Use zero exit code in freeAndExit() for sparc64.Alex Rønne Petersen
2024-08-19std.Thread: Implement freeAndExit() for sparc32.Alex Rønne Petersen
2024-08-13std.Thread: Merge riscv32/riscv64 assembly in freeAndExit().Alex Rønne Petersen
2024-08-13std.Thread: Fix freeAndExit() syscall numbers for mips64.Alex Rønne Petersen
These just seem to have been copy/pasted from mips32.
2024-08-13std.Thread: Fix freeAndExit() assembly for powerpc.Alex Rønne Petersen
Wrong source/destination register order.
2024-08-12std.Thread: Explain apparently pointless mips instruction in freeAndExit().Alex Rønne Petersen
https://git.musl-libc.org/cgit/musl/commit/?id=ce3688eca920aa77549323f84e21f33522397115
2024-08-09std: add loongarch64 support (#20915)YANG Xudong
Co-authored-by: Alex Rønne Petersen <alex@alexrp.com>
2024-07-30std.os.linux.tls: Refactor and improve documentation.Alex Rønne Petersen
* Elaborate on the sub-variants of Variant I. * Clarify the use of the TCB term. * Rename a bunch of stuff to be more accurate/descriptive. * Follow Zig's style around namespacing more. * Use a structure for the ABI TCB. No functional change intended.
2024-07-29std.Thread: Add some syscall comments to ↵Alex Rønne Petersen
LinuxThreadImpl.ThreadCompletion.freeAndExit().
2024-07-29std.Thread: Implement LinuxThreadImpl.ThreadCompletion.freeAndExit() for ↵Alex Rønne Petersen
riscv32.
2024-07-28std.Target.Cpu.Arch: Remove the `aarch64_32` tag.Alex Rønne Petersen
This is a misfeature that we inherited from LLVM: * https://reviews.llvm.org/D61259 * https://reviews.llvm.org/D61939 (`aarch64_32` and `arm64_32` are equivalent.) I truly have no idea why this triple passed review in LLVM. It is, to date, the *only* tag in the architecture component that is not, in fact, an architecture. In reality, it is just an ILP32 ABI for AArch64 (*not* AArch32). The triples that use `aarch64_32` look like `aarch64_32-apple-watchos`. Yes, that triple is exactly what you think; it has no ABI component. They really, seriously did this. Since only Apple could come up with silliness like this, it should come as no surprise that no one else uses `aarch64_32`. Later on, a GNU ILP32 ABI for AArch64 was developed, and support was added to LLVM: * https://reviews.llvm.org/D94143 * https://reviews.llvm.org/D104931 Here, sanity seems to have prevailed, and a triple using this ABI looks like `aarch64-linux-gnu_ilp32` as you would expect. As can be seen from the diffs in this commit, there was plenty of confusion throughout the Zig codebase about what exactly `aarch64_32` was. So let's just remove it. In its place, we'll use `aarch64-watchos-ilp32`, `aarch64-linux-gnuilp32`, and so on. We'll then translate these appropriately when talking to LLVM. Hence, this commit adds the `ilp32` ABI tag (we already have `gnuilp32`).
2024-07-26riscv: workarounds for riscv threadingDavid Rubin
2024-07-24Replace some dynamic functions with static ones.Lucas Santos
PR [19271](https://github.com/ziglang/zig/pull/19271) added some static function implementations from kernel32, but some parts of the library still used the dynamically loaded versions.
2024-07-15Better implementation of GetLastError. (#20623)Lucas Santos
Instead of calling the dynamically loaded kernel32.GetLastError, we can extract it from the TEB. As shown by [Wine](https://github.com/wine-mirror/wine/blob/34b1606019982b71818780bc84b76460f650af31/include/winternl.h#L439), the last error lives at offset 0x34 of the TEB in 32-bit Windows and at offset 0x68 in 64-bit Windows.
2024-07-09test: Add `spawn` behavior testmochalins
2024-07-07bootstrap: fix buildJacob Young
2024-06-23std: Extended type checks for Thread startFn return typeBram
2024-06-17std: fix pthread_{get,set}name_np return type ABIIsaac Freund
I believe this was accidentally broken when the E enum for errno values was introduces. These functions are quite the special case in that they return the error value directly rather than returning -1 and passing the error value through the errno variable. In any case, using a u16 as the return type at the ABI boundary where a c_int is expected is asking for trouble.
2024-05-09handle visionos target OS tag in the compilerJakub Konka
* rename .xros to .visionos as agreed in the tracking issue * add support for VisionOS platform in the MachO linker
2024-04-22Fix WASI threads, againFrank Denis
Properly call the entrypoint when it doesn't return an optional error, and use the per-thread copy of the arguments list.
2024-03-21Merge pull request #19348 from jedisct1/wasi-threads-compfixAndrew Kelley
Unbreak support for WASI threads
2024-03-20bsd: followup to std.posix extraction from std.osMichael Dusan
netbsd fix: - `Futex.zig:542:56: error: expected error union type, found 'c_int'` openbsd fix: - `emutls.zig:10:21: error: root struct of file 'os' has no member named 'abort'` - `Thread.zig:627:22: error: expected 6 argument(s), found 5`
2024-03-19extract std.posix from std.osAndrew Kelley
closes #5019
2024-03-19WASI-thread: panic if no allocator is givenFrank Denis
2024-03-18Unbreak support for WASI threadsFrank Denis
2024-03-16Windows: Replace CreatePipe with ntdll implementationStephen Gregoratto
This implementation is now a direct replacement for the `kernel32` one. New bitflags for named pipes and other generic ones were added based on browsing the ReactOS sources. `UNICODE_STRING.Buffer` has also been changed to be nullable, as this is what makes the implementation work. This required some changes to places accesssing the buffer after a `SUCCESS`ful return, most notably `QueryObjectName` which even referred to it being nullable.
2024-03-11std.builtin: make atomic order fields lowercaseTristan Ross
2024-02-26Change many test blocks to doctests/decltestsRyan Liptak
2024-02-26Remove redundant test name prefixes now that test names are fully qualifiedRyan Liptak
Follow up to #19079, which made test names fully qualified. This fixes tests that now-redundant information in their test names. For example here's a fully qualified test name before the changes in this commit: "priority_queue.test.std.PriorityQueue: shrinkAndFree" and the same test's name after the changes in this commit: "priority_queue.test.shrinkAndFree"
2024-02-24Fix handling of Windows (WTF-16) and WASI (UTF-8) pathsRyan Liptak
Windows paths now use WTF-16 <-> WTF-8 conversion everywhere, which is lossless. Previously, conversion of ill-formed UTF-16 paths would either fail or invoke illegal behavior. WASI paths must be valid UTF-8, and the relevant function calls have been updated to handle the possibility of failure due to paths not being encoded/encodable as valid UTF-8. Closes #18694 Closes #1774 Closes #2565
2024-02-24Update deprecated `std.unicode` function usagesRyan Liptak
2024-02-06std.os.linux.MAP: use a packed structAndrew Kelley
Introduces type safety to this constant. Eliminates one use of `usingnamespace`.
2024-01-29std.Thread: fix off-by-one in PosixThreadImpl (#18711)Christian Flicker
by removing ZST special case
2023-12-30doc: possible typo at `std.Thread.spawn` commentLeonardo Gatti
2023-11-22rework std.atomicAndrew Kelley
* move std.atomic.Atomic to std.atomic.Value * fix incorrect argument order passed to testing.expectEqual * make the functions be a thin wrapper over the atomic builtins and stick to the naming conventions. * remove pointless functions loadUnchecked and storeUnchecked. Instead, name the field `raw` instead of `value` (which is redundant with the type name). * simplify the tests by not passing every possible combination. Many cases were iterating over every possible combinations but then not even using the for loop element value! * remove the redundant compile errors which are already implemented by the language itself. * remove dead x86 inline assembly. this should be implemented in the language if at all.
2023-10-31std/Thread: remove unnecessary `@ptrCast` (#17766)XXIV
2023-10-02Add illumos OS tagStephen Gregoratto
- Adds `illumos` to the `Target.Os.Tag` enum. A new function, `isSolarish` has been added that returns true if the tag is either Solaris or Illumos. This matches the naming convention found in Rust's `libc` crate[1]. - Add the tag wherever `.solaris` is being checked against. - Check for the C pre-processor macro `__illumos__` in CMake to set the proper target tuple. Illumos distros patch their compilers to have this in the "built-in" set (verified with `echo | cc -dM -E -`). Alternatively you could check the output of `uname -o`. Right now, both Solaris and Illumos import from `c/solaris.zig`. In the future it may be worth putting the shared ABI bits in a base file, and mixing that in with specific `c/solaris.zig`/`c/illumos.zig` files. [1]: https://github.com/rust-lang/libc/tree/6e02a329a2a27f6887ea86952f389ca11e06448c/src/unix/solarish
2023-07-31Merge pull request #16622 from jacobly0/cbe-asm-compatAndrew Kelley
CBE: fix regressions and get new targets passing behavior tests
2023-07-31Revert "std.Thread: refining stack size from platform minimum, changes more ↵Andrew Kelley
targetted towards platform like Linux/musl (#15791)" This reverts commit 41502c6aa53a3da31b276c23c4db74db7d04796b.
2023-07-31std: cleanup asm usageJacob Young
After fixing some issues with inline assembly in the C backend, the std cleanups have the side effect of making these functions compatible with the backend, allowing it to be used on linux without linking libc.
2023-07-26Fix counting in SingleThreadedRwLock's tryLockShared (#16560)Jim Price
Additionally we add RwLock to Thread.zig's list of tests
2023-06-26default to single-threaded for WebAssemblyLuuk de Gram
When targeting WebAssembly, we default to building a single-threaded build as threads are still experimental. The user however can enable a multi- threaded build by specifying '-fno-single-threaded'. It's a compile-error to enable this flag, but not also enable shared-memory.