Commit Graph

28 Commits (0a9672fb86b84658f8780f57e769be45e41f3034)

Author SHA1 Message Date
Haze Booth 4cb4097b08
Update ErrorUnion thread spawn result to return null instead of 0 2020-05-05 04:15:43 -04:00
Andrius Mitkus 6481b02fdc std: fix posix Thread.spawn to accept all startFn types 2020-04-25 16:15:25 -04:00
Andrew Kelley 9e7ae06249
std lib API deprecations for the upcoming 0.6.0 release
See #3811
2020-03-30 14:23:22 -04:00
LemonBoy d788b0cd8b std: Minor changes to TLS handling
* Always allocate an info block per-thread so that libc can store
  important stuff there.
* Respect ABI-mandated alignment in more places.
* Nicer code, use slices/pointers instead of raw addresses whenever
  possible.
2020-03-28 11:20:38 -04:00
Andrew Kelley f7f563ea53
Revert "Merge pull request #4807 from LemonBoy/tls-touchups"
This reverts commit ee6fda2297, reversing
changes made to f313ab18ae.

This caused a test failure:

```
behavior.misc.test "behavior-arm-linux-none-Debug-bare-multi thread local variable"...test failure
/home/vsts/work/1/s/lib/std/testing.zig:191:14: 0x4608f in std.testing.expect (test)
    if (!ok) @panic("test failure");
             ^
/home/vsts/work/1/s/test/stage1/behavior/misc.zig:616:11: 0x53e93 in behavior.misc.test "behavior-arm-linux-none-Debug-bare-multi thread local variable" (test)
    expect(S.t == 1235);
          ^
```
2020-03-25 21:12:24 -04:00
Andrew Kelley ee6fda2297
Merge pull request #4807 from LemonBoy/tls-touchups
std: Minor changes to TLS handling
2020-03-25 18:53:04 -04:00
LemonBoy abcd9ac9d0 Use const instead of var 2020-03-25 12:37:44 +01:00
LemonBoy a34f67aa66 std: Minor changes to TLS handling
* Always allocate an info block per-thread so that libc can store
  important stuff there.
* Respect ABI-mandated alignment in more places.
* Nicer code, use slices/pointers instead of raw addresses whenever
  possible.
2020-03-25 12:08:50 +01:00
LemonBoy c3f93be00c std: Tell pthread the guard page size is zero
On NetBSD this is needed to avoid crashes in pthread_join as the default
value for the guard page size is not ignored even though a custom stack
address is specified.
2020-03-23 23:26:34 +01:00
LemonBoy b21d3535a5 std: Fix parameters for pthread_attr_setstack
The guard page size shouldn't be taken into account, pthread is only
interested in the usable area.
2020-03-23 20:12:10 +01:00
LemonBoy 09a5f172f8 std: Different thread stack allocation for NetBSD
* NetBSD is stricter than other OSs and doesn't allow mprotect to mark a
  non-accessible region as RW
* Fix mprotect call over the whole stack, oops
2020-03-23 19:50:29 +01:00
LemonBoy 013ada1b59 std: More type checks for Thread startFn return type
Closes #4756
2020-03-18 10:37:35 -04:00
Andrew Kelley 6fcf6716be
std.Thread.cpuCount on Windows uses the PEB
rather than calling GetSystemInfo from kernel32.dll. Also remove
OutOfMemory from the error set.
2020-02-29 22:13:09 -05:00
LemonBoy 845af5c552 Handle one more error 2020-02-29 23:11:36 +01:00
Andrew Kelley 4616af0ca4
introduce operating system version ranges as part of the target
* re-introduce `std.build.Target` which is distinct from `std.Target`.
   `std.build.Target` wraps `std.Target` so that it can be annotated as
   "the native target" or an explicitly specified target.
 * `std.Target.Os` is moved to `std.Target.Os.Tag`. The former is now a
   struct which has the tag as well as version range information.
 * `std.elf` gains some more ELF header constants.
 * `std.Target.parse` gains the ability to parse operating system
   version ranges as well as glibc version.
 * Added `std.Target.isGnuLibC()`.
 * self-hosted dynamic linker detection and glibc version detection.
   This also adds the improved logic using `/usr/bin/env` rather than
   invoking the system C compiler to find the dynamic linker when zig
   is statically linked. Related: #2084
   Note: this `/usr/bin/env` code is work-in-progress.
 * `-target-glibc` CLI option is removed in favor of the new `-target`
   syntax. Example: `-target x86_64-linux-gnu.2.27`

closes #1907
2020-02-28 14:51:53 -05:00
Vexu 538d9a5dd8
remove uses of `@ArgType` and `@IntType` 2020-02-24 23:39:03 +02:00
Vexu 45da72c5b6
remove usages of `@typeId`, `@memberCount`, `@memberName` and `@memberType` 2020-02-24 23:09:01 +02:00
Andrew Kelley 53913acaf7
zig fmt and update `extern fn` to `callconv(.C)` 2020-01-06 15:34:50 -05:00
Robin Voetter 8c096707b7
Additional replacements of @typeOf with @TypeOf 2019-12-10 11:09:41 -05:00
Robin Voetter 4b4fbe3887
Replace @typeOf with @TypeOf in all zig source
This change was mostly made with `zig fmt` and this also modified some whitespace. Note that in some files, `zig fmt` produced incorrect code, so the change was made manually.
2019-12-10 11:09:41 -05:00
Andrew Kelley b7be57766b
Merge pull request #3715 from daurnimator/towards-afd
Misc windows additions+fixes
2019-12-02 16:12:55 -05:00
Andrew Kelley ad214c7aa0
bring your own OS layer in the std lib
closes #3784
2019-12-02 15:02:17 -05:00
LemonBoy e1e06e6766 linux-i386 support 2019-11-30 16:13:33 +01:00
daurnimator 21ca54f560
std: add alertable argument for windows.WaitForSingleObject 2019-11-27 13:00:59 +11:00
Andrew Kelley 47f06be369
string literals are now null terminated
this also deletes C string literals from the language, and then makes
the std lib changes and compiler changes necessary to get the behavior
tests and std lib tests passing again.
2019-11-21 20:43:41 -05:00
Andrew Kelley e0db54e89d
update the codebase to use `@as` 2019-11-08 15:57:24 -05:00
Andrew Kelley 60cd11bd4b
get rid of std.os.foo.is_the_target
It had the downside of running all the comptime blocks and resolving
all the usingnamespaces of each system, when just trying to discover if
the current system is a particular one.

For Darwin, where it's nice to use `std.Target.current.isDarwin()`, this
demonstrates the utility that #425 would provide.
2019-10-24 01:14:52 -04:00
Andrew Kelley ed36dbbd9c
mv std/ lib/
that's all this commit does. further commits will fix cli flags and
such.

see #2221
2019-09-25 23:35:41 -04:00