lean4-htt/src/Std
Henrik Böving 406bda8807
feat: implement a Selector for async TCP (#8078)
This PR is a follow up to #8055 and implements a `Selector` for async
TCP in order to allow IO multiplexing using TCP sockets.

As we must not commit to actually fetching data from the socket buffer
this cannot be implemented by just racing on `recv?`. Instead we perform
a call to `uv_read_start` and pass an `alloc_cb` that allocates no
memory at all. According to the docs of
[`uv_alloc_cb`](https://docs.libuv.org/en/v1.x/handle.html#c.uv_alloc_cb)
this is guaranteed to give us a `UV_ENOBUFS` in the relevant callback.
Thus we can first run this "zero read" and then go into one of three
cases:
1. We get cancelled before the zero read completes, in this case just
cancel the zero read and give up.
2. The zero read completes and we loose the race for completing the
`select`, in this case just don't do anything anymore
3. The zero read completes and we win the race for completing the
`select`, in this case we perform the actual read on the socket. As we
know that data is available already (since the read callback of the zero
read is only triggered if data actually is available) we know that the
subsequent actual read should complete right away.

In this way we avoid any data loss if we loose the race.
2025-04-24 16:05:35 +00:00
..
Classes chore: adjust BEq classes (#7855) 2025-04-16 13:24:23 +00:00
Data chore: do not use the coercion α → Option α in Init and Std (#8085) 2025-04-24 13:35:01 +00:00
Internal feat: implement a Selector for async TCP (#8078) 2025-04-24 16:05:35 +00:00
Net feat: add network interfaces (#7578) 2025-03-24 17:57:05 +00:00
Sat perf: fix linearity issue in bv_decide (#8036) 2025-04-21 13:51:21 +00:00
Sync chore: do not use the coercion α → Option α in Init and Std (#8085) 2025-04-24 13:35:01 +00:00
Tactic feat: add BitVec.sdivOverflow definition and lemmas for overflow in signed and unsigned division (#7671) 2025-04-24 15:27:18 +00:00
Time chore: do not use the coercion α → Option α in Init and Std (#8085) 2025-04-24 13:35:01 +00:00
Classes.lean feat: tree map data structures and operations (#6914) 2025-02-11 14:47:47 +00:00
Data.lean fix: import all raw tree map modules into Std.Data (#8044) 2025-04-24 10:06:32 +00:00
Internal.lean feat: implement basic async IO with timers (#6505) 2025-01-13 18:11:04 +00:00
Net.lean feat: Std.Net.Addr (#6563) 2025-01-09 09:33:03 +00:00
Sat.lean feat: Std.Sat.AIG (#4953) 2024-08-12 14:58:38 +00:00
Sync.lean feat: add Std.SharedMutex (#7770) 2025-04-03 08:30:54 +00:00
Tactic.lean chore: fix spelling mistakes in src/Std/ (#5431) 2024-09-23 20:39:34 +00:00
Time.lean chore: fix spelling mistakes (#7328) 2025-04-07 01:15:48 +00:00