Files
scriptc/docs/content
Chris Tate 96c82719b6 Deliver queued worker messages before immediates, as Node does
A thread's event loop delivered one message from its workers or its
parent per loop turn, so timers and setImmediate callbacks ran between
messages that were already queued. Node's MessagePort delivers, in one
callback, the messages queued when it starts and those that arrive
meanwhile until it has taken 1000, with a microtask checkpoint after
each, before the loop goes on to the check phase.

- scr_worker_dispatch starts a batch when it delivers a message: the
  messages queued then, and at least 1000 in all.
- scr_workers_more continues the loop pass while the next event in the
  thread's mailbox is a message and the batch has room; other events
  (online, exit, error, stdio) keep their order and their turns.
- scr_mailbox_head_kind and scr_mailbox_count_kind read the mailbox's
  first event kind and the number of queued events of a kind.
- Corpus 6211 checks the order of messages, nextTick, microtasks and
  setImmediate for worker-to-parent and parent-to-worker messages
  against Node.
2026-10-21 10:07:56 -05:00
..
2026-10-21 03:13:45 -05:00