zig/lib/std
Loris Cro 0156d68f0c Io.Threaded PoC reimplementation
This is a reimplementation of Io.Threaded that fixes the issues
highlighted in the recent Zulip discussion. It's poorly tested but it
does successfully run to completion the litmust test example that I
offered in the discussion.

This implementation has the following key design decisions:

- `t.cpu_count` is used as the threadpool size.
- `t.concurrency_limit` is used as the maximum number of
  "burst, one-shot" threads that can be spawned by `io.concurrent` past
  `t.cpu_count`.
- `t.available_thread_count` is the number of threads in the pool that
  is not currently busy with work (the bookkeeping happens in the worker
  function).
- `t.one_shot_thread_count` is the number of active threads that were
  spawned by `io.concurrent` past `t.cpu_count`.

In this implementation:

- `io.async` first tries to decrement `t.available_thread_count`. If
  there are no threads available, it tries to spawn a new one if possible,
  otherwise it runs the task immediately.
- `io.concurrent` first tries to use a thread in the pool same as
  `io.async`, but on failure (no available threads and pool size limit
  reached) it tries to spawn a new one-shot thread. One shot threads
  run a different main function that just executes one task, decrements
  the number of active one shot threads, and then exits.

A relevant future improvement is to have one-shot threads stay on for a
few seconds (and potentially pick up a new task) to amortize spawning
costs.
2025-11-07 12:43:25 +01:00
..
Build Step.Run: Fix for convertPathArg when cwd and path args are on different drives 2025-11-06 03:40:33 -08:00
builtin feat: init x86_16 arch via CBE 2025-10-27 11:19:51 +01:00
c remove all Oracle Solaris support 2025-10-27 07:35:38 -07:00
compress
crypto std.crypto: improve KT documentation, use key_length for B3 key length (#25807) 2025-11-07 08:20:04 +01:00
debug fix typo in std.debug.ElfFile.loadSeparateDebugFile 2025-10-31 09:44:47 +01:00
dwarf
fmt
fs std.Io.Threaded: add ioBasic which disables networking 2025-10-29 06:20:51 -07:00
hash
heap std: fix compilation errors on Windows 2025-10-29 06:20:50 -07:00
http Revert "std.http: disable failing test on 32-bit arm" 2025-11-01 11:21:28 -04:00
Io Io.Threaded PoC reimplementation 2025-11-07 12:43:25 +01:00
json std.debug.lockStderrWriter: also return ttyconf 2025-10-30 09:31:28 +00:00
math Coff: implement threadlocal variables 2025-10-10 22:47:47 -07:00
mem std.mem.Allocator: fix resize doc comment 2025-10-22 11:41:16 +02:00
meta
os std.os.windows: eliminate forwarder function in kernel32 (#25766) 2025-10-31 13:54:50 +00:00
posix std: make signal numbers into an enum 2025-10-29 06:20:51 -07:00
process std.Io.Threaded: add ioBasic which disables networking 2025-10-29 06:20:51 -07:00
Random
sort
tar compiler: update for introduction of std.Io 2025-10-29 06:20:49 -07:00
Target Merge pull request #25558 from jacobly0/elfv2-load-obj 2025-10-30 12:09:13 -04:00
testing
Thread std.os.windows: eliminate forwarder function in kernel32 (#25766) 2025-10-31 13:54:50 +00:00
time
tz
unicode
valgrind
zig std.zig.AstRlAnnotate: remove pointless switch 2025-11-06 23:57:16 +00:00
zon
array_hash_map.zig
array_list.zig std.ArrayList: actaully memset to undefined in shrinkRetainingCapacity and clearRetainingCapacity 2025-11-06 05:30:41 -08:00
ascii.zig std: Skip element comparisons if mem.order args point to same memory 2025-10-31 18:34:33 -07:00
atomic.zig std.atomic: define cache line size for alpha, hppa, microblaze, sh 2025-10-23 09:27:17 +02:00
base64.zig Base64DecoderWithIgnore.calcSizeUpperBound cannot return an error (#25834) 2025-11-07 08:16:34 +01:00
bit_set.zig
BitStack.zig
buf_map.zig
buf_set.zig
Build.zig std.debug.lockStderrWriter: also return ttyconf 2025-10-30 09:31:28 +00:00
builtin.zig Merge pull request #25592 from ziglang/init-std.Io 2025-10-29 13:51:37 -07:00
c.zig std.c: add missing MINSIGSTKSZ for some FreeBSD targets 2025-11-01 09:58:05 +01:00
coff.zig Coff: implement threadlocal variables 2025-10-10 22:47:47 -07:00
compress.zig
crypto.zig std.crypto: add AES-CCM and CBC-MAC (#25526) 2025-10-14 12:00:44 +02:00
debug.zig std.os.windows: eliminate forwarder function in kernel32 (#25766) 2025-10-31 13:54:50 +00:00
deque.zig
DoublyLinkedList.zig *LinkedList.remove() assumes node is in the list 2025-10-25 21:10:02 -07:00
dwarf.zig
dynamic_library.zig std: fix seekBy unit test 2025-10-29 06:20:49 -07:00
elf.zig Elf2: load relocations from input objects 2025-10-29 18:06:17 -04:00
enums.zig
fmt.zig test: add test case for enum-literal with '{t}' format 2025-11-06 13:45:21 +08:00
fs.zig std.Io.Threaded: add ioBasic which disables networking 2025-10-29 06:20:51 -07:00
gpu.zig
hash.zig
hash_map.zig std.hash_map: tune slow unit tests 2025-10-29 06:20:52 -07:00
heap.zig remove all Oracle Solaris support 2025-10-27 07:35:38 -07:00
http.zig
Io.zig Io.Queue: fix empty and full states being indistinguishable. 2025-11-04 04:24:32 -05:00
json.zig
leb128.zig
log.zig std.log: colorize output in default implementation 2025-10-30 09:31:30 +00:00
macho.zig
math.zig
mem.zig std: Skip element comparisons if mem.order args point to same memory 2025-10-31 18:34:33 -07:00
meta.zig std: disable a few failing tests on hexagon 2025-10-16 22:11:51 +02:00
multi_array_list.zig
once.zig
os.zig std.fs: use BadPathName rather than InvalidWtf8 on Windows 2025-10-29 06:20:50 -07:00
pdb.zig
pie.zig std.pie: add sh support 2025-10-23 09:27:17 +02:00
posix.zig std: serenity has preadv now 2025-11-02 14:45:32 -08:00
priority_dequeue.zig
priority_queue.zig
process.zig remove all Oracle Solaris support 2025-10-27 07:35:38 -07:00
Progress.zig std: make signal numbers into an enum 2025-10-29 06:20:51 -07:00
Random.zig std.Io.net: progress towards DNS resolution 2025-10-29 06:20:48 -07:00
SemanticVersion.zig
simd.zig std: disable a few failing tests on hexagon 2025-10-16 22:11:51 +02:00
SinglyLinkedList.zig SinglyLinkedList.remove docs: Assumes -> asserts 2025-10-25 21:28:54 -07:00
sort.zig
start.zig Elf2: start implementing dynamic linking 2025-10-29 18:15:09 -04:00
static_string_map.zig
std.zig std.Io.Threaded: install and cleanup signal handlers 2025-10-29 06:20:52 -07:00
tar.zig std.Io: add dirOpenDir and WASI impl 2025-10-29 06:20:50 -07:00
Target.zig std.Target: bump vulkan max version to 1.4.331 2025-10-31 15:46:44 +01:00
testing.zig std.debug.lockStderrWriter: also return ttyconf 2025-10-30 09:31:28 +00:00
Thread.zig std.os.windows: eliminate forwarder function in kernel32 (#25766) 2025-10-31 13:54:50 +00:00
time.zig std: fix some Io compilation errors 2025-10-29 06:20:49 -07:00
treap.zig
tz.zig
unicode.zig std: move some windows path checking logic 2025-10-29 06:20:50 -07:00
Uri.zig compiler: update for introduction of std.Io 2025-10-29 06:20:49 -07:00
valgrind.zig
wasm.zig
zig.zig std.debug.lockStderrWriter: also return ttyconf 2025-10-30 09:31:28 +00:00
zip.zig
zon.zig