Control flushing to stdout... core.osthread.Thread + arsd.terminal

aberba karabutaworld at gmail.com
Fri Jun 5 20:05:28 UTC 2020


On Friday, 5 June 2020 at 12:28:17 UTC, Adam D. Ruppe wrote:
> On Friday, 5 June 2020 at 11:45:31 UTC, aberba wrote:
>> How can I make Thread.sleep() only run AFTER "Wait, signing 
>> you in ..." is written (force flushed) to stdout?
>
> just use explicit `terminal.flush();` any time you want the 
> output to appear immediately.
>
> Terminal does its own aggressive buffering internally (which I 
> kinda regret) and only flushes with 1) it is full or 2) you ask 
> for input, unless you call that flush function.

Why was the initial decision to handle buffering that way in 
terminal?


More information about the Digitalmars-d-learn mailing list