Hello everyone,
I can not find answer from MSDN. My question is, when Console.ReadKey is called on a thread,
1. the thread will be still in running status (like we call Sleep), which will consume CPU time?
2. or the thread will be in wait status like we call WaitOne, and keyboard press will signal the event?
thanks in advance,
George

Fernando Soto44 reputationPosted Jun 12, 2008, 4:13 AM EDT
Hi George;
From the Micrfosoft documentation located at :
http://msdn.microsoft.com/en-us/library/x3h8xffw(VS.80).aspx
"The ReadKey method waits, that is, blocks on the thread issuing the ReadKey method, until a character or function key is pressed. A character or function key can be pressed in combination with one or more ALT, CTRL, or SHIFT modifier keys. However, pressing a modifier key by itself will not cause the ReadKey method to return."
The theead calling the ReadKey method is placed in a wait state, thread is not executing any code while it the wait state, until a key is pressed on the keyboard.
Fernando
George GeorgeRank #1,736 · 870 reputationPosted Jun 12, 2008, 4:17 AM EDT
Thanks Fernando!
Question answered.
regards,
George
Fernando Soto44 reputationPosted Jun 12, 2008, 9:46 AM EDT