C++ - how does Sleep() and cin work?

后端 未结 7 1878
独厮守ぢ
独厮守ぢ 2021-02-05 10:38

Just curious. How does actually the function Sleep() work (declared in windows.h)? Maybe not just that implementation, but anyone. With that I mean - how is it implemented? How

7条回答
  •  长情又很酷
    2021-02-05 11:17

    The answer depends on the operating system, but generally speaking, the operating system either schedules some other code to run elsewhere in another thread, or if it literally has nothing to do, it gets the CPU to wait until a hardware event occurs, which causes the CPU to jump to some code called an interrupt handler, which can then decide what code to run.

提交回复
热议问题