Why does this delay-loop start to run faster after several iterations with no sleep?

后端 未结 2 1773
死守一世寂寞
死守一世寂寞 2020-11-27 04:29

Consider:

#include 
#include 
#include 
using namespace std;

const int times = 1000;
const int N = 100000;

vo         


        
2条回答
  •  萌比男神i
    2020-11-27 04:57

    A call to usleep may or may not result in a context switch. If it does, it will take longer than if it doesn't.

提交回复
热议问题