11095 Commits

Author SHA1 Message Date
Andrew Kelley
071607877d Io.EventLoop: select stub 2025-07-20 10:38:39 -07:00
Andrew Kelley
0f67ea4fa4 introduce Io.select and implement it in thread pool 2025-07-20 10:38:39 -07:00
Jacob Young
7b5886118d Io.Condition: implement full API 2025-07-20 10:38:39 -07:00
Jacob Young
fdf15fae97 EventLoop: implement detached fibers 2025-07-20 10:38:39 -07:00
Andrew Kelley
f2b24479ee EventLoop: let the allocator do its job
to bucket and free fiber allocations
2025-07-20 10:38:39 -07:00
Jacob Young
9a652cc42a 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-07-20 10:38:39 -07:00
Jacob Young
f0919a4cea EventLoop: revert incorrect optimization 2025-07-20 10:38:39 -07:00
Andrew Kelley
fa937d686d EventLoop: remove broken mechanism for making deinit block on detached 2025-07-20 10:38:39 -07:00
Andrew Kelley
74969d1c40 std.Io.Condition: change primitive to support only one
and no timer
2025-07-20 10:38:39 -07:00
Andrew Kelley
59270425aa EventLoop: take DetachedClosure into account when allocating 2025-07-20 10:38:39 -07:00
Andrew Kelley
5aa3d1425e EventLoop: implement detached async
data races on deinit tho
2025-07-20 10:38:39 -07:00
Jacob Young
f3553049cb Io: implement faster mutex 2025-07-20 10:38:39 -07:00
Andrew Kelley
ebf92042e3 std.Io: add detached async 2025-07-20 10:38:39 -07:00
Andrew Kelley
a7790bd32e implement Mutex, Condition, and Queue 2025-07-20 10:38:38 -07:00
Jacob Young
012ef81b8b Io: implement sleep and fix cancel bugs 2025-07-20 10:38:38 -07:00
Jacob Young
1fbc251ccd EventLoop: implement thread-local queues and cancellation 2025-07-20 10:38:38 -07:00
Andrew Kelley
988f58341b std.Io: introduce cancellation 2025-07-20 10:38:38 -07:00
Andrew Kelley
dab5dd286f better API for Io.async 2025-07-20 10:38:38 -07:00
Jacob Young
90cc7f4adf 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-07-20 10:38:38 -07:00
Jacob Young
4f214b97ec 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-07-20 10:38:38 -07:00
Andrew Kelley
50724cf1c3 WIP 2025-07-20 10:38:38 -07:00
Andrew Kelley
d4ff3745d5 start adding fs functions to std.Io 2025-07-20 10:38:38 -07:00
Andrew Kelley
db499b82b5 free freeing wrong amount in thread pool impl 2025-07-20 10:38:38 -07:00
Jacob Young
1216e807ac 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-07-20 10:38:38 -07:00
Jacob Young
048a40dac7 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-07-20 10:38:38 -07:00
Andrew Kelley
1d7a69cb7d update threaded fibers impl to actually storing args
sorry, something still not working correctly
2025-07-20 10:38:38 -07:00
Andrew Kelley
ad3c5f0292 fix context passing in threaded Io impl 2025-07-20 10:38:38 -07:00
Jacob Young
0c1f5dbd64 EventLoop: implement main idle fiber 2025-07-20 10:38:38 -07:00
Jacob Young
c7b406f2ad EventLoop: add threads 2025-07-20 10:38:38 -07:00
Jacob Young
03bb08d337 EventLoop: rewrite context switching 2025-07-20 10:38:38 -07:00
Jacob Young
93054125fe EventLoop: prepare for threading 2025-07-20 10:38:38 -07:00
Andrew Kelley
07ee4977da demo: single-threaded green threads implementation 2025-07-20 10:38:38 -07:00
Andrew Kelley
6ae18714b7 make thread pool satisfy async/await interface 2025-07-20 10:38:38 -07:00
Andrew Kelley
5b2f54fc80 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-07-20 10:38:38 -07:00
Andrew Kelley
8373788c4c
Merge pull request #24488 from ziglang/more
std.zig: finish updating to new I/O API
2025-07-20 11:24:41 +02:00
Marc Tiehuis
4780cc50cf std.Io.Writer: support alignment for {t} specifier 2025-07-20 10:30:17 +02:00
Andrew Kelley
e43617e686
Merge pull request #24505 from ziglang/json
update std.json and std.zon to new I/O API
2025-07-20 09:48:25 +02:00
Alex Rønne Petersen
c58cce7999 std.Build.Step.Run: fix up 681d324c49e7cdc773cc891ea49ed69dd03c23c7
https://github.com/ziglang/zig/pull/24151/files#r2217494741
2025-07-20 07:25:05 +02:00
Andrew Kelley
c40fb96ca3 std.Io.Writer: fix writeSliceSwap
tried to be too clever, wrote bad code
2025-07-19 22:12:37 -07:00
Andrew Kelley
741a66e03c std.zig.llvm.BitcodeReader: fix 32-bit skipBlock 2025-07-19 19:57:37 -07:00
Andrew Kelley
8489bab1f4 std.Io.Writer: add missing writeSliceSwap 2025-07-19 19:57:37 -07:00
Andrew Kelley
bd64bf0e47 std.mem: add byteSwapAllElements 2025-07-19 19:57:37 -07:00
Andrew Kelley
83d1f88ac5 std.debug: add assertAligned 2025-07-19 19:57:37 -07:00
Andrew Kelley
93378e2e7b std.zig: finish updating to new I/O API 2025-07-19 19:57:37 -07:00
Andrew Kelley
0fb7a0a94b std.zon: better namespace for Serializer 2025-07-19 18:27:09 -07:00
Andrew Kelley
c3da98cf5a std.zon: update to new I/O API 2025-07-19 18:27:09 -07:00
Andrew Kelley
c30df072bd std.json: update to new I/O API
also do a little bit of namespace cleanup
2025-07-19 16:05:01 -07:00
Andrew Kelley
a288266f33 std.Io.Reader: remove aggressive assert from fill
with `.fixed("")` you should still be able to do `fill(1)` and have it
return error.EndOfStream.
2025-07-19 16:05:01 -07:00
Andrew Kelley
a0d1682921 std.hash.RapidHash: remove
Its design keeps evolving. See
https://github.com/Nicoshev/rapidhash/releases

It's great to see the design improving, but over time, this will lead to
code rot; versions that aren't widely used but would still have to live
in the standard library forever and be maintained.

Better to be maintained as an external dependency that applications can
opt into. Then, in a few years, if a version proves to be stable and
widely adopted, it could be considered for inclusion in the standard
library.
2025-07-19 11:49:33 -07:00
Alexandre
4e6a04929d Changed u64 to usize to fix #24208 2025-07-19 15:31:44 +02:00