tobogganSe connecter

louise

Clone avec HTTPS, un jeton personnel en mot de passe, ou avec SSH, une clé ajoutée dans vos paramètres.

Runtime: every actor waiting on a socket is woken, and no readiness is lost (issue #221)

The reactor kept one waiting actor per socket and a ready flag per
socket, and both lost wake-ups:
- A second actor parking on a socket (one reading while another writes)
  replaced the first, which was never woken; and `io_unwait`, removing
  by socket only, could remove another actor's wait.
- An event reached one actor: it woke the waiter if there was one and
  set the flag only if there was none. An actor between its
  `WouldBlock` and its parking when another thread polled — or a second
  one arriving after the flag was consumed — parked for an event that,
  edge-triggered, never came again.

Now:
- `io_waiters` keeps every pid waiting on a socket; an event wakes them
  all (a reader woken by writability retries and parks again), and
  `io_unwait(token, pid)` removes only its own.
- The reactor counts the socket events it delivers (`io_events`, raised
  under the control lock). An operation reads the count before it tries,
  and `io_wait` refuses to park if it moved: one atomic load per
  attempt, no lock, at the price of a rare retry when another socket's
  event came in between. The per-socket flag, `io_closed`, and the
  scheduler pointers kept only for it are gone.

Test: `two_actors_wait_on_one_socket` (cli.rs, fixtures/net) parks a
reader and a writer on one socket and needs both woken, on 1 and 4
threads, with the leak oracle at 0. With the old runtime the program
dies before the transfer ends. The runtime ABI doc gains the rule and a
history entry (no ABI change).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

olivier · il y a 1 mois · 2a4fe9660fc72c0195ebe9d7f3185bb593379169

Parents 0222bdd

6 fichiers modifiés, 206 ajouts, 64 suppressions