aboutsummaryrefslogtreecommitdiff
path: root/lib/std/Thread.zig
AgeCommit message (Collapse)Author
2023-01-29std: restrict mem.span() and mem.len() to sentinel terminated pointersIsaac Freund
These functions are currently footgunny when working with pointers to arrays and slices. They just return the stated length of the array/slice without iterating and looking for the first sentinel, even if the array/slice is a sentinel terminated type. From looking at the quite small list of places in the standard library/compiler that this change breaks existing code, the new code looks to be more readable in all cases. The usage of std.mem.span/len was totally unneeded in most of the cases affected by this breaking change. We could remove these functions entirely in favor of other existing functions in std.mem such as std.mem.sliceTo(), but that would be a somewhat nasty breaking change as std.mem.span() is very widely used for converting sentinel terminated pointers to slices. It is however not at all widely used for anything else. Therefore I think it is better to break these few non-standard and potentially incorrect usages of these functions now and at some later time, if deemed worthwhile, finally remove these functions. If we wait for at least a full release cycle so that everyone adapts to this change first, updating for the removal could be a simple find and replace without needing to worry about the semantics.
2023-01-16std.Thread: make Id smaller where possibler00ster91
2022-12-13update usages of `@call`Veikka Tuominen
2022-11-04all: rename i386 to x86Ali Chraghi
2022-09-12remove pointless discardsAndrew Kelley
2022-08-30std.Thread: fix freeAndExit on x86_64-linux (#12693)biexelar
Previously, this function used incorrect registers for the munmap syscall, leading to detached threads not cleaning up. closes #12690 Co-authored-by: bxlr <biexelar@diroot.org>
2022-07-04std.Thread: fix mutable ref of temporaryAndrew Kelley
The previous code is a compile error in stage2 as well as the upcoming lang spec.
2022-05-27math: make `cast` return optional instead of an errorAli Chraghi
2022-05-17std.Thread: insert a missing `@alignCast`Andrew Kelley
stage1 has a missing compile error for this situation.
2022-05-13target: Rename sparcv9 -> sparc64Koakuma
Rename all references of sparcv9 to sparc64, to make Zig align more with other projects. Also, added new function to convert glibc arch name to Zig arch name, since it refers to the architecture as sparcv9. This is based on the suggestion by @kubkon in PR 11847. (https://github.com/ziglang/zig/pull/11487#pullrequestreview-963761757)
2022-04-26std.Thread: ResetEvent improvements (#11523)protty
* std: start removing redundant ResetEvents * src: fix other uses of std.Thread.ResetEvent * src: add builtin.sanitize_thread for tsan detection * atomic: add Atomic.fence for proper fencing with tsan * Thread: remove the other ResetEvent's and rewrite the current one * Thread: ResetEvent docs * zig fmt + WaitGroup.reset() fix * src: fix build issues for ResetEvent + tsan * Thread: ResetEvent tests * Thread: ResetEvent module doc * Atomic: replace llvm *p memory constraint with *m * panicking: handle spurious wakeups in futex.wait() when waiting for abort() * zig fmt
2022-04-23std.Thread: Mutex and Condition improvements (#11497)protty
* Thread: minor cleanups * Thread: rewrite Mutex * Thread: introduce Futex.Deadline * Thread: Condition rewrite + cleanup * Mutex: optimize lock fast path * Condition: more docs * Thread: more mutex + condition docs * Thread: remove broken Condition test * Thread: zig fmt * address review comments + fix Thread.DummyMutex in GPA * Atomic: disable bitRmw x86 inline asm for stage2 * GPA: typo mutex_init * Thread: remove noalias on stuff * Thread: comment typos + clarifications
2022-02-27std: rename `sched_yield` to `yield` and move it to `std.Thread`David John
2022-02-26fix typo on Thread's getHandle docsEndel Dreyer
2022-02-15Merge pull request #10003 from viriuwu/nt-thread-nameVeikka Tuominen
std.Thread.getName/setName: rework windows implementation
2022-02-15std.Thread(windows): use NT internals for name fnsviri
2022-02-08update RwLock to use static initialization (#10838)billzez
2022-01-29fs: Use `OpenMode` enum instead of read/write flags.Sage Hane
2022-01-11Fix a bug in std.Thread.Condition and add a basic Condition test. (#10538)afranchuk
* Fix FUTEX usage in std.Thread.Condition - It was using an old name.
2021-12-19stage1, stage2: rename c_void to anyopaque (#10316)Isaac Freund
zig fmt now replaces c_void with anyopaque to make updating code easy.
2021-12-03Merge pull request #9910 from mikdusan/dragonflyAndrew Kelley
dragonfly: port Thread.setname/getname
2021-11-30allocgate: renamed getAllocator function to allocatorLee Cannon
2021-11-30allocgate: std Allocator interface refactorLee Cannon
2021-11-30std lib API deprecations for the upcoming 0.9.0 releaseAndrew Kelley
See #3811
2021-11-15updates for haiku stdcAl Hoang
* add team_info, area_info * update signature for get_next_image_info * add error checks for haiku system calls * update and cleanup of haiku constants
2021-10-10SPARCv9: Fix freeAndExit implementationKoakuma
This fixes the wrong branch target and register check. (https://github.com/ziglang/zig/issues/9801)
2021-10-09housekeeping: return error.UnsupportedMichael Dusan
Return error at end of std.Thread.setName/getName to simplify flow-control.
2021-10-09dragonfly: port std.Thread.setname/getnameMichael Dusan
2021-09-24Initial bringup of the Solaris/Illumos portStephen Gregoratto
2021-09-01std.os reorg: regression fixes to stack_t, and std.ThreadAndrew Kelley
2021-09-01std.os reorg: more fixes caught by CIAndrew Kelley
2021-09-01std.os: more reorganization effortsAndrew Kelley
* std lib tests are passing on x86_64-linux with and without -lc * stage2 is building from source on x86_64-linux * down to 38 remaining uses of `usingnamespace`
2021-08-29zig fmt: respect trailing commas in inline assemblyjdmichaud
2021-08-24remove redundant license headers from zig standard libraryAndrew Kelley
We already have a LICENSE file that covers the Zig Standard Library. We no longer need to remind everyone that the license is MIT in every single file. Previously this was introduced to clarify the situation for a fork of Zig that made Zig's LICENSE file harder to find, and replaced it with their own license that required annual payments to their company. However that fork now appears to be dead. So there is no need to reinforce the copyright notice in every single file.
2021-08-24Linux/SPARCv9: account for branch delay in freeAndExit()Koakuma
2021-08-24std: [breaking] move errno to become an nonexhaustive enumAndrew Kelley
The primary purpose of this change is to eliminate one usage of `usingnamespace` in the standard library - specifically the usage for errno values in `std.os.linux`. This is accomplished by truncating the `E` prefix from error values, and making errno a proper enum. A similar strategy can be used to eliminate some other `usingnamespace` sites in the std lib.
2021-08-09Merge remote-tracking branch 'origin' into libc-wasi-testTakeshi Yoneda
2021-07-30Add freeAndExit() implementation for Linux/SPARCv9Koakuma
2021-07-29thread: implement setName/getNameVincent Rischmann
2021-07-27WASI,libc: enable tests.Takeshi Yoneda
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2021-07-20stage2: miscellaneous fixes for the branchAndrew Kelley
* Breaking language change: inline assembly must use string literal syntax. This is in preparation for inline assembly improvements that involve more integration with the Zig language. This means we cannot rely on text substitution. * Liveness: properly handle inline assembly and function calls with more than 3 operands. - More than 35 operands is not yet supported. This is a low priority to implement. - This required implementation in codegen.zig as well. * Liveness: fix bug causing incorrect tomb bits. * Sema: enable switch expressions that are evaluated at compile-time. - Runtime switch instructions still need to be reworked in this branch. There was a TODO left here (by me) with a suggestion to do some bigger changes as part of the AIR memory reworking. Now that time has come and I plan to honor the suggestion in a future commit before merging this branch. * AIR printing: fix missing ')' on alive instructions. We're back to "hello world" working for the x86_64 backend.
2021-07-03zig fmtkprotty
2021-07-01std.Thread: move linux detach code to inline asmkprotty
2021-06-30zig fmtkprotty
2021-06-30std.Thread: non-zero child_tid to avoid racy join()kprotty
2021-06-30std.Thread: add CLONE_CHILD_SETTID to fix join()kprotty
2021-06-30std.Thread: fix tls 9386 linux typokprotty
2021-06-30std.Thread: more cleanup & testingkprotty
2021-06-30std.Thread: more fixeskprotty
2021-06-30std.Thread: fix posixkprotty