a 在典型的无限窗口消息循环中是否Sleep(sometime)
有用,或者它只是无用甚至有害?
一些示例包含Sleep
,其中大多数不包含。
// Main message loop:
MSG msg;
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
Sleep(500); // As pointed out below, completely nonsense
Sleep(5); // Would have been the better example, but still bad
}