Sleep 比对 (Win32API 与 STL )

	OutputDebugStringA("begin 1========");
	for (int i = 0; i < 1800; i++)
	{
		Sleep(2);
	}
	OutputDebugStringA("end 1========");





	OutputDebugStringA("begin 2========");
	for (int i = 0; i < 1800; i++)
	{
		std::this_thread::sleep_for(std::chrono::milliseconds(2));
	}
	OutputDebugStringA("end 2========");

第一次
Sleep消耗时间: 23.96765327s

第二次
std::this_thread::sleep_for 消耗时间 : 23.88462829s

posted @ 2017-06-22 23:52  scott_h  阅读(752)  评论(0编辑  收藏  举报