Commit graph

12113 commits

Author SHA1 Message Date
Andrew Kelley
7aa4062f5c introduce Io.select and implement it in thread pool 2025-10-29 06:20:48 -07:00
Jacob Young
c4fcf85c43 Io.Condition: implement full API 2025-10-29 06:20:48 -07:00
Jacob Young
3eb7be5cf6 EventLoop: implement detached fibers 2025-10-29 06:20:48 -07:00
Andrew Kelley
0f105a8a10 EventLoop: let the allocator do its job
to bucket and free fiber allocations
2025-10-29 06:20:48 -07:00
Jacob Young
08ce000276 EventLoop: fix std.Io.Condition implementation
1. a fiber can't put itself on a queue that allows it to be rescheduled
 2. allow the idle fiber to unlock a mutex held by another fiber by
    ignoring reschedule requests originating from the idle fiber
2025-10-29 06:20:48 -07:00
Jacob Young
e366b13a65 EventLoop: revert incorrect optimization 2025-10-29 06:20:48 -07:00
Andrew Kelley
4063205746 EventLoop: remove broken mechanism for making deinit block on detached 2025-10-29 06:20:48 -07:00
Andrew Kelley
929b616e0f std.Io.Condition: change primitive to support only one
and no timer
2025-10-29 06:20:48 -07:00
Andrew Kelley
8773b63241 EventLoop: take DetachedClosure into account when allocating 2025-10-29 06:20:48 -07:00
Andrew Kelley
266bcfbf2f EventLoop: implement detached async
data races on deinit tho
2025-10-29 06:20:48 -07:00
Jacob Young
f84aca36c3 Io: implement faster mutex 2025-10-29 06:20:48 -07:00
Andrew Kelley
a1c1d06b19 std.Io: add detached async 2025-10-29 06:20:48 -07:00
Andrew Kelley
0d4b358dd8 implement Mutex, Condition, and Queue 2025-10-29 06:20:48 -07:00
Jacob Young
08b609a79f Io: implement sleep and fix cancel bugs 2025-10-29 06:20:48 -07:00
Jacob Young
5041c9ad9c EventLoop: implement thread-local queues and cancellation 2025-10-29 06:20:48 -07:00
Andrew Kelley
e7caf3a54c std.Io: introduce cancellation 2025-10-29 06:20:47 -07:00
Andrew Kelley
a29b2122d2 better API for Io.async 2025-10-29 06:20:47 -07:00
Jacob Young
d958077203 EventLoop: fix futex usage
How silly of me to forget that the kernel doesn't implement its own API.
The scheduling is not great, but at least doesn't deadlock or hammer.
2025-10-29 06:20:47 -07:00
Jacob Young
db0dd3a480 EventLoop: get file operations working
Something is horribly wrong with scheduling, as can be seen in the
debug output, but at least it somehow manages to exit cleanly...
2025-10-29 06:20:47 -07:00
Andrew Kelley
238de05d2c WIP 2025-10-29 06:20:47 -07:00
Andrew Kelley
66b0f7e92b start adding fs functions to std.Io 2025-10-29 06:20:47 -07:00
Andrew Kelley
08bb7c6c88 free freeing wrong amount in thread pool impl 2025-10-29 06:20:47 -07:00
Jacob Young
1493c3b5f3 EventLoop: move context after the async closure
This avoids needing to store more sizes and alignments.  Only the result
alignment needs to be stored, because `Fiber` is at a fixed zero offset.
2025-10-29 06:20:47 -07:00
Jacob Young
29355ff21c EventLoop: fix incorrect alignment panic
When the previous fiber did not request to be registered as an awaiter,
it may not have actually been a full blown `Fiber`, so only create the
`Fiber` pointer when needed.
2025-10-29 06:20:47 -07:00
Andrew Kelley
4c7c0c4178 update threaded fibers impl to actually storing args
sorry, something still not working correctly
2025-10-29 06:20:47 -07:00
Andrew Kelley
31ed2d6715 fix context passing in threaded Io impl 2025-10-29 06:20:47 -07:00
Jacob Young
f1dd06b01f EventLoop: implement main idle fiber 2025-10-29 06:20:47 -07:00
Jacob Young
9d0f44f08a EventLoop: add threads 2025-10-29 06:20:47 -07:00
Jacob Young
629a20459d EventLoop: rewrite context switching 2025-10-29 06:20:47 -07:00
Jacob Young
fe6f1efde4 EventLoop: prepare for threading 2025-10-29 06:20:47 -07:00
Andrew Kelley
4d56267938 demo: single-threaded green threads implementation 2025-10-29 06:20:47 -07:00
Andrew Kelley
cb9f9bf58d make thread pool satisfy async/await interface 2025-10-29 06:20:47 -07:00
Andrew Kelley
21b7316772 introduce std.Io interface
which is planned to have all I/O operations in the interface, but for
now has only async and await.
2025-10-29 06:20:47 -07:00
Ryan Liptak
6568f0f75b
Merge pull request #25705 from squeek502/linked-list-remove-docs
Document that `remove` of Singly/DoublyLinkedList relies on the node being in the list
2025-10-29 05:11:58 -07:00
Alex Rønne Petersen
7881a60f1a
std.Target.aarch64: updates for LLVM 21.1.5 2025-10-29 07:48:12 +01:00
Adrian
4e9dd099c5
std.heap.debug_allocator outdated doc (#25634)
Fixed a relatively small outdated doc string, referring to the bucket linked list.
2025-10-28 10:26:04 +01:00
Alex Rønne Petersen
06d9e3bc06
Merge pull request #25691 from GasInfinity-Forks/x86_16-gcc
feat: init x86_16 arch via CBE
2025-10-28 10:19:21 +01:00
Sean
35e1755c99
Fix stale reference bug in std.zig.system.resolveTargetQuery (#25713)
Co-authored-by: Alex Rønne Petersen <alex@alexrp.com>
2025-10-28 10:17:09 +01:00
Alex Rønne Petersen
dba1bf9353 remove all Oracle Solaris support
There is no straightforward way for the Zig team to access the Solaris system
headers; to do this, one has to create an Oracle account, accept their EULA to
download the installer ISO, and finally install it on a machine or VM. We do not
have to jump through hoops like this for any other OS that we support, and no
one on the team has expressed willingness to do it.

As a result, we cannot audit any Solaris contributions to std.c or other
similarly sensitive parts of the standard library. The best we would be able to
do is assume that Solaris and illumos are 100% compatible with no way to verify
that assumption. But at that point, the solaris and illumos OS tags would be
functionally identical anyway.

For Solaris especially, any contributions that involve APIs introduced after the
OS was made closed-source would also be inherently more risky than equivalent
contributions for other proprietary OSs due to the case of Google LLC v. Oracle
America, Inc., wherein Oracle clearly demonstrated its willingness to pursue
legal action against entities that merely copy API declarations.

Finally, Oracle laid off most of the Solaris team in 2017; the OS has been in
maintenance mode since, presumably to be retired completely sometime in the 2030s.

For these reasons, this commit removes all Oracle Solaris support.

Anyone who still wishes to use Zig on Solaris can try their luck by simply using
illumos instead of solaris in target triples - chances are it'll work. But there
will be no effort from the Zig team to support this use case; we recommend that
people move to illumos instead.
2025-10-27 07:35:38 -07:00
GasInfinity
104c272ae5
feat: init x86_16 arch via CBE 2025-10-27 11:19:51 +01:00
GasInfinity
55c0693c4a
fix: make compiler_rt and std.Io.Writer compile on 16-bit platforms. 2025-10-27 11:17:48 +01:00
GasInfinity
914acf13cb
chore: make std.zig.target.intByteSize return an u16 2025-10-27 11:13:25 +01:00
Alex Rønne Petersen
9161923405
Revert "std.Target: xtensa defaults to windowed ABI"
This reverts commit c55e83eab1.

This was a misreading of XtensaFeatures.td on my part.
2025-10-27 06:09:33 +01:00
Alex Rønne Petersen
c9e0df97f9 std.debug.cpu_context: fix mcontext alignment for x86_64-illumos
It contains a upad128_t array which increases its alignment.
2025-10-26 08:48:21 +01:00
Ryan Liptak
63a45b8ecd SinglyLinkedList.remove docs: Assumes -> asserts
Removing a node that is not in the list invokes safety-checked illegal behavior, so "asserts" is the recommended language to use.
2025-10-25 21:28:54 -07:00
IOKG04
a83db33ba2 *LinkedList.remove() assumes node is in the list
probably closes https://github.com/ziglang/zig/issues/16795
2025-10-25 21:10:02 -07:00
Techatrix
bd1e960bc0 fix std.fs.path.resolveWindows on UNC paths with mixed path separators 2025-10-26 02:18:11 +02:00
Ryan Zezeski
ece9640a3e
std.c: implement sigrtmin()/sigrtmax() for solaris/illumos 2025-10-25 12:44:17 +02:00
Ryan Zezeski
bd1332acae
std.c: define MSG constants for solaris/illumos 2025-10-25 12:44:17 +02:00
Ryan Zezeski
ac3e4f4519
std.c: define arc4random_buf() for illumos 2025-10-25 12:44:17 +02:00