.net - Why does Console.ReadKey() block output of Console.WriteLine called in another thread? -


i have simple console app.

static void main(string[] args) {     doasync();     console.readkey(); } 

here doasync starts set of task , returns not waiting tasks' completition. each task writes console, ouptut not shown before key pressed.
when use console.readline works fine.

so i'm curious readkey() pecularities.

from the documentation console.readkey():

the readkey method waits, is, blocks on thread issuing readkey method, until character or function key pressed.

what acquire lock on console.internalsyncobject, prevents further operations on console.

the console.readline() method not block thread in way.

reading this article i'm guessing have .net 4.5 installed?


Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -