Waiting for a key is not the same as time stopping
A console read that had nothing to hand over blocked in read(), and while it was blocked nothing told the devices any time had gone by. The whole machine stood still: the clock, the cursor, a disk settling, a note decaying. Measured, four real seconds of sitting at the prompt bought zero cycles. A window has never done this. consoleGatherLine and the key mode loop both spend a frame and then say so, and the comment on consoleWaited gives the reason - a display controller blinking a cursor does not stop because the processor is waiting on a key, and neither does a disk finishing a read. The terminal path simply never got it. How it showed was a note left in its release after a program exited. Frozen mid-decay, it came out a snippet at a time, one per keystroke, because a keystroke was the only thing that let the machine run at all. So a terminal read now polls a frame at a time and tells the devices about each one. Four seconds now buys 3.85 million cycles, which is the wall clock, which is what the window has always done. ONLY WHEN THERE IS REALLY A TERMINAL, the same rule the escape sequences and the erase character follow. A file or a pipe keeps blocking: every recorded test on this machine is reproducible because emulated time does not depend on how fast the other end of a pipe is writing, and that must stay true. The full suite is unchanged. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E2JrLzFvuFX9fgi1LDRjrW
This commit is contained in:
co-authored by
Claude Opus 5
parent
41d65d6346
commit
7f96499438
@@ -190,6 +190,12 @@ is how a program says it has finished; WAIT stops only the CPU's use of the bus.
|
||||
runs, devices run, and the moment any of them raises a line the CPU carries on with the
|
||||
instruction after the WAIT.
|
||||
|
||||
**The same is true of a program waiting on a key.** A console read that has nothing to hand
|
||||
over stops the CPU and not the machine: the clock goes on, the cursor goes on blinking, a disk
|
||||
goes on settling and a note goes on decaying. Time spent waiting for somebody to type is time,
|
||||
and a device that stopped because the processor was waiting would be a device that behaved
|
||||
differently depending on how fast the person at the keyboard was.
|
||||
|
||||
**A line that is already up means there is nothing to wait for**, and WAIT does nothing at
|
||||
all. That is what makes the ordinary shape of it safe:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user