69 Commits

Author SHA1 Message Date
protty
18f3034629
std.Thread: ResetEvent improvements (#11523)
* 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-26 16:48:56 -05:00
protty
963ac60918
std.Thread: Mutex and Condition improvements (#11497)
* 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-04-23 19:35:56 -05:00
David John
139b731d82 std: rename sched_yield to yield and move it to std.Thread 2022-02-27 15:34:02 -05:00
Endel Dreyer
cd9a6fed4f fix typo on Thread's getHandle docs 2022-02-26 10:48:37 +02:00
Veikka Tuominen
cf5009f9af
Merge pull request #10003 from viriuwu/nt-thread-name
std.Thread.getName/setName: rework windows implementation
2022-02-15 13:23:09 +02:00
viri
0bde55e881
std.Thread(windows): use NT internals for name fns 2022-02-15 01:20:54 -06:00
billzez
470c8ca48c
update RwLock to use static initialization (#10838) 2022-02-08 23:35:48 -05:00
Sage Hane
e288148f60
fs: Use OpenMode enum instead of read/write flags. 2022-01-29 15:52:08 +02:00
afranchuk
7c4c49ff07
Fix a bug in std.Thread.Condition and add a basic Condition test. (#10538)
* Fix FUTEX usage in std.Thread.Condition - It was using an old name.
2022-01-11 13:04:24 -05:00
Isaac Freund
9f9f215305
stage1, stage2: rename c_void to anyopaque (#10316)
zig fmt now replaces c_void with anyopaque to make updating
code easy.
2021-12-19 00:24:45 -05:00
Andrew Kelley
2a0adef583
Merge pull request #9910 from mikdusan/dragonfly
dragonfly: port Thread.setname/getname
2021-12-03 17:29:55 -08:00
Lee Cannon
1093b09a98
allocgate: renamed getAllocator function to allocator 2021-11-30 23:32:47 +00:00
Lee Cannon
85de022c56
allocgate: std Allocator interface refactor 2021-11-30 23:32:47 +00:00
Andrew Kelley
902df103c6 std lib API deprecations for the upcoming 0.9.0 release
See #3811
2021-11-30 00:13:07 -07:00
Al Hoang
426f54026b updates for haiku stdc
* 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-11-15 00:29:26 -06:00
Koakuma
834202bf98 SPARCv9: Fix freeAndExit implementation
This fixes the wrong branch target and register check.
(https://github.com/ziglang/zig/issues/9801)
2021-10-10 09:13:17 +07:00
Michael Dusan
e376fab186
housekeeping: return error.Unsupported
Return error at end of std.Thread.setName/getName to simplify flow-control.
2021-10-09 03:52:28 -04:00
Michael Dusan
d621f4322b
dragonfly: port std.Thread.setname/getname 2021-10-09 03:52:28 -04:00
Stephen Gregoratto
87fd502fb6 Initial bringup of the Solaris/Illumos port 2021-09-24 14:06:16 -04:00
Andrew Kelley
0932b0d9b3 std.os reorg: regression fixes to stack_t, and std.Thread 2021-09-01 17:54:07 -07:00
Andrew Kelley
f8dd4b13d6 std.os reorg: more fixes caught by CI 2021-09-01 17:54:07 -07:00
Andrew Kelley
7f03cfe161 std.os: more reorganization efforts
* 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-09-01 17:54:06 -07:00
jdmichaud
49c9975484
zig fmt: respect trailing commas in inline assembly 2021-08-29 11:57:32 +02:00
Andrew Kelley
d29871977f remove redundant license headers from zig standard library
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-24 12:25:09 -07:00
Koakuma
e3840817d7 Linux/SPARCv9: account for branch delay in freeAndExit() 2021-08-24 14:08:54 -04:00
Andrew Kelley
a98fa56ae9 std: [breaking] move errno to become an nonexhaustive enum
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-24 01:23:28 -04:00
Takeshi Yoneda
97560cd915 Merge remote-tracking branch 'origin' into libc-wasi-test 2021-08-09 14:39:26 +09:00
Koakuma
7aaea20e7e Add freeAndExit() implementation for Linux/SPARCv9 2021-07-30 13:23:41 -04:00
Vincent Rischmann
df4fe87163 thread: implement setName/getName 2021-07-29 12:02:12 +02:00
Takeshi Yoneda
1e20a62126 WASI,libc: enable tests.
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2021-07-27 09:01:00 +09:00
Andrew Kelley
d17f492017 stage2: miscellaneous fixes for the branch
* 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-20 12:19:16 -07:00
kprotty
c8f90a7e7e zig fmt 2021-07-03 11:49:07 -05:00
kprotty
483eb8e057 std.Thread: move linux detach code to inline asm 2021-07-01 17:34:23 -05:00
kprotty
98106b09d5 zig fmt 2021-06-30 21:49:38 -05:00
kprotty
2309c81a78 std.Thread: non-zero child_tid to avoid racy join() 2021-06-30 21:49:00 -05:00
kprotty
2a6ba41020 std.Thread: add CLONE_CHILD_SETTID to fix join() 2021-06-30 21:49:00 -05:00
kprotty
6dd6604638 std.Thread: fix tls 9386 linux typo 2021-06-30 21:49:00 -05:00
kprotty
f0fa129e9b std.Thread: more cleanup & testing 2021-06-30 21:49:00 -05:00
kprotty
7b323f84ca std.Thread: more fixes 2021-06-30 21:49:00 -05:00
kprotty
c6fb968a3d std.Thread: fix posix 2021-06-30 21:49:00 -05:00
kprotty
fd4a607bb2 std.Thread: fix futex test + thread errors 2021-06-30 21:49:00 -05:00
kprotty
6a903fc4c0 std.Thread: more typo fixes 2021-06-30 21:49:00 -05:00
kprotty
009c95b8ec std.Thread: more fixes 2021-06-30 21:49:00 -05:00
kprotty
5f4a40e6aa std.Thread: typo fixes 2 2021-06-30 21:49:00 -05:00
kprotty
b1f37b4ead std.Thread: uh more typo fixes 2021-06-30 21:49:00 -05:00
kprotty
d016caaccb std.Thread: more compile error fixes 2021-06-30 21:49:00 -05:00
kprotty
ca1e61b851 std.Thread: fix some typos 2021-06-30 21:49:00 -05:00
kprotty
6ff64895cf std.Thread: add tests + getCurrentId() returns ints when possible 2021-06-30 21:49:00 -05:00
kprotty
235fcc5ba6 std.Thread: another typo fix 2021-06-30 21:48:59 -05:00
kprotty
e16d3d162a std.Thread: rewrite + extensions 2021-06-30 21:48:59 -05:00