68 Commits

Author SHA1 Message Date
heidezomp
9ea4ddae97 linuxWaitFd: make NetworkSubsystemFailed error unreachable
This error from os.poll is Windows-specific, so unreachable on Linux.
2020-11-16 14:03:19 -08:00
frmdstryr
36f1788762 Add missing arg 2020-11-01 15:40:42 -05:00
Isaac Freund
504f259c24
std/event: fix zig fmt regression 2020-10-27 21:40:22 +01:00
Isaac Freund
1b34365ca1
std/event: fix poll error set handling
This has been broken since 127fa80
2020-10-27 21:28:31 +01:00
Sebastien Marie
35a7247a2c
Merge branch 'master' into openbsd-minimal 2020-10-17 17:38:23 +02:00
Andrew Kelley
3b4432d9a6
Merge pull request #6655 from kprotty/timers
Integrate std.time.sleep with the event loop
2020-10-14 21:49:45 -04:00
Vignesh Rajagopalan
2ab0c7391a Rename .macosx to .macos 2020-10-12 18:56:25 -04:00
kprotty
12508025a4 Add more comments & cleanup AutoResetEvent 2020-10-11 19:16:07 -05:00
kprotty
e9a4c3dd82 fix DelayQueue typos 2020-10-11 14:21:36 -05:00
kprotty
aa53f6d0b5 integrate std.time.sleep with the event loop 2020-10-11 14:18:19 -05:00
Sébastien Marie
f33a610c84 add minimal openbsd support 2020-10-11 08:23:36 +00:00
Loris Cro
53dee08af9 add WaitGroup to std.event
Signed-off-by: Loris Cro <kappaloris@gmail.com>
2020-10-07 04:34:09 -04:00
Andrew Kelley
7f7e2d608a Revert "revert adding std.event.Loop.runDetached"
This reverts commit 70f37679035e64bacfc4807709da37bc02fbb346.

After discussion, I can see the value provided here, specifically with
avoiding the footgun of defer { suspend { free(@frame()); } }.

However the doc comments are updated to explain the semantics directly,
rather than basing them on the behavior of another programming language.
2020-10-05 14:41:51 -07:00
Andrew Kelley
70f3767903 revert adding std.event.Loop.runDetached
I'd like to discuss this before adding it. I think this is the wrong
direction to go with this API.
2020-10-03 17:13:22 -07:00
Alexandros Naskos
bf0afaa876
std.event.Loop.runDetached should be pub 2020-10-01 16:50:05 +03:00
Loris Cro
16f0419700 add runDetached to event loop
Signed-off-by: Loris Cro <kappaloris@gmail.com>
2020-09-29 14:53:36 +02:00
Andrew Kelley
a502604702
Merge pull request #6412 from kristoff-it/generalize-event-loop
Make os.zig not depend on the event loop
2020-09-25 17:26:44 -04:00
Andrew Kelley
f8b3543cab I think this test is still flakey
re-opens #4922
2020-09-24 22:57:03 -07:00
Loris Cro
c196c27af8 recvfrom
Signed-off-by: Loris Cro <kappaloris@gmail.com>
2020-09-24 22:06:41 +02:00
Loris Cro
419aea54cb sendto
Signed-off-by: Loris Cro <kappaloris@gmail.com>
2020-09-24 22:06:41 +02:00
Loris Cro
7fec5b3def pwritev
Signed-off-by: Loris Cro <kappaloris@gmail.com>
2020-09-24 22:06:41 +02:00
Loris Cro
7a07c62a07 pwrite
Signed-off-by: Loris Cro <kappaloris@gmail.com>
2020-09-24 22:06:21 +02:00
Loris Cro
18f6629bd8 writev
Signed-off-by: Loris Cro <kappaloris@gmail.com>
2020-09-24 22:06:03 +02:00
Loris Cro
9075f8e5a1 write
Signed-off-by: Loris Cro <kappaloris@gmail.com>
2020-09-24 22:05:41 +02:00
Loris Cro
59ecdaea12 preadv
Signed-off-by: Loris Cro <kappaloris@gmail.com>
2020-09-24 22:04:43 +02:00
Loris Cro
bd9f2369d5 pread
Signed-off-by: Loris Cro <kappaloris@gmail.com>
2020-09-24 22:04:05 +02:00
Loris Cro
bc35435ca6 readv
Signed-off-by: Loris Cro <kappaloris@gmail.com>
2020-09-24 22:03:12 +02:00
Loris Cro
08364ac773 read
Signed-off-by: Loris Cro <kappaloris@gmail.com>
2020-09-24 22:00:55 +02:00
Loris Cro
730428bfd6 connect
Signed-off-by: Loris Cro <kappaloris@gmail.com>
2020-09-24 21:56:27 +02:00
Loris Cro
e85c89630e accept
Signed-off-by: Loris Cro <kappaloris@gmail.com>
2020-09-24 21:56:27 +02:00
Timon Kruiper
bbff6bd675 Eventloop: Enable basic event loop test, fixed by previous commit
Closes #4922
2020-09-23 18:38:28 +02:00
Timon Kruiper
0eed7ec9d5 Eventloop: Fix deadlock in linux event loop implementation
A simple empty main with evented-io would not quit, because some
threads were still waiting to be resumed (by the os). The os.write to
the eventfd only wakes up one thread and thus there are multiple writes
needed to wake up all the other threads.
2020-09-23 11:41:31 +02:00
Isaac Freund
486a774e5f std: add option to use single-threaded event loop
std.event.Loop does not yet work in single threaded builds. However,
using evented io on a single thread can be very convenient. This commit
allows settind @import("root").event_loop_mode to .single_threaded
in order to allow this without reimplementing the startup code in
start.zig
2020-09-10 15:40:38 -04:00
Andrew Kelley
4a69b11e74 add license header to all std lib files
add SPDX license identifier
copyright ownership is zig contributors
2020-08-20 16:07:04 -04:00
Andrew Kelley
53d011fa1a (breaking) std.time fixups and API changes
Remove the constants that assume a base unit in favor of explicit
x_per_y constants.

nanosecond calendar timestamps now use i128 for the type. This affects
fs.File.Stat, std.time.nanoTimestamp, and fs.File.updateTimes.

calendar timestamps are now signed, because the value can be less than
the epoch (the user can set their computer time to whatever they wish).

implement std.os.clock_gettime for Windows when clock id is
CLOCK_CALENDAR.
2020-05-24 21:40:08 -04:00
Loris Cro
7e8b859095 fix oneshot flag erroneusly set as filter_flag 2020-05-07 13:41:17 -04:00
Loris Cro
a78ac96134 fix crash in single-threaded builds 2020-05-07 13:41:02 -04:00
Andrew Kelley
ba43492c0e
Merge pull request #5268 from tadeokondrak/remove-callconv-redundant-syntax
Remove syntax redundant with callconv
2020-05-07 12:42:26 -04:00
Timon Kruiper
b336dda076 Standard library: Fix a regression in loop.waitUntilFdWritableOrReadable
This broke async io on linux.
Regressed in 8ebcca6734e07aea29098ca4c63c0216b3099d0e
2020-05-06 13:14:06 -04:00
Tadeo Kondrak
6745a6f6f6
zig fmt 2020-05-05 09:38:02 -06:00
Tadeo Kondrak
af00afed98
zig fmt 2020-05-05 05:55:25 -06:00
Andrew Kelley
7998e2b0f4 Merge remote-tracking branch 'origin/master' into FireFox317-windows-evented-io 2020-05-02 14:16:59 -04:00
Chris Heyes
8ebcca6734
Get evented io code paths to build on macOS (#5233)
* Get evented io code paths to build on macOS
* Use mode_t instead of usize where appropriate
2020-05-02 14:14:46 -04:00
Andrew Kelley
2272a07ca0 std.event.Loop: promote the fs thread to be available for all OS's 2020-05-02 00:41:19 -04:00
Tadeo Kondrak
07c1be80c2
Fix std.event.Loop.readv 2020-04-29 04:33:29 -06:00
Andrew Kelley
b8796be79d disable flaky event loop test
See #4922
2020-04-12 23:02:39 -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
Andrew Kelley
0720f338d4
add std.event.Loop pread and faccessat
progress towards std lib tests passing with evented I/O mode
2020-03-07 19:13:21 -05:00
Andrew Kelley
c81345c8ae
breaking: std.os read/write functions + sendfile
* rework os.sendfile and add macosx support, and a fallback
   implementation for any OS.
 * fix sendto compile error
 * std.os write functions support partial writes. closes #3443.
 * std.os pread / pwrite functions can now return `error.Unseekable`.
 * std.fs.File read/write functions now have readAll/writeAll variants
   which loop to complete operations even when partial reads/writes
   happen.
 * Audit std.os read/write functions with respect to Linux returning
   EINVAL for lengths greater than 0x7fff0000.
 * std.os read/write shim functions do not unnecessarily loop. Since
   partial reads/writes are part of the API, the caller will be forced
   to loop anyway, and so that would just be code bloat.
 * Improve doc comments
 * Add a non-trivial test for std.os.sendfile
 * Fix std.os.pread on 32 bit Linux
 * Add missing SYS_sendfile bit on aarch64
2020-03-03 02:25:26 -05: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