Thread: Console.ReadKey

  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    1,579

    Console.ReadKey

    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

  2. #2
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,130
    Calling Sleep on a thread will not consume CPU time. That's the whole point.

    The thread will block. A blocked thread should not consume CPU. Test it.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

Popular pages Recent additions subscribe to a feed