加入比较短时间的Sleep()一般对时效性影响不大,但能极大地降低CPU占用。
- 比如,这里我们用coolfun::UI_suspend()等待按键函数的源码来举例:
#include<conio.h>
#include<iostream>
#include<windows.h>
using namespace std;
int main()
{
cout << "<< 按任意键继续... ";
for (int i = 0; _kbhit() == 0;) //等待按键
{
switch (i++) //选择打印最后的一个字符,使之有动画效果
{
case 0:cout << "\b/"; break;
case 1:cout << "\b-"; break;
case 2:cout << "\b\\"; break;
case 3:
{
cout << "\b|";
i = 0;
}break;
}
//Sleep(100); //暂停100毫秒(1秒 = 1000毫秒)
}
}
- 效果:
- 但是它的CPU占用相当的高,一直了 8% 左右,而这还仅仅是一个简单的动画功能。
- 那接下来我们在循环内加一条Sleep():
- 然后再来看看它的CPU占用:
- 可以看到,显示的是CPU占用 0%,显然是因为占用太低了,所以才显示了 0%。
- 这句Sleep(100),暂停的100毫秒对用户来说基本没感觉,但却大幅度降低了CPU占用,而且动画效果甚至更舒服了:
https://ciprofloxacin.tech/# cipro pharmacy
https://nolvadex.life/# lexapro and tamoxifen
get cheap propecia without dr prescription buying generic propecia no prescription cost cheap propecia tablets
cytotec pills online: buy cytotec online – cytotec pills online
http://indiaph24.store/# legitimate online pharmacies india
india pharmacy mail order indian pharmacy fast delivery indian pharmacy online
buying from online mexican pharmacy: mexican pharmaceuticals online – mexican mail order pharmacies
pharmacy website india http://indiaph24.store/# india pharmacy mail order
online shopping pharmacy india
world pharmacy india Generic Medicine India to USA pharmacy website india
https://indiaph24.store/# top 10 pharmacies in india
Как выбрать дренажную помпу: руководство по выбору оптимального решения
buy prescription drugs from india https://indiaph24.store/# best india pharmacy
Online medicine order
Окна для дачи: идеальное решение для комфорта и уюта
МАСЛА ДЛЯ ЛЕГКОВЫХ АВТОМОБИЛЕЙ North sea — качество и надежность от ведущих производителей
Все о дизайне интерьера
Tash Maral: идеальное место для отдыха в Архызе, КЧР
Благоустройство территории: создание комфортного окружения для жизни и отдыха
Все о дизайне интерьера
Ремонт тепловизоров в Москве: профессиональный сервис для вашей техники
Экологически чистые материалы в строительстве: забота о природе и здоровье
Известняковый щебень: применение и разнообразие сортов
Ландшафтный дизайн: создание гармоничного и уникального окружения
VSDC Free Video Editor: Your Ultimate Tool for Creating Stunning Videos
Преимущества песка и щебня по ГОСТу: качество и надежность материалов для строительства
Все о современных технологиях
Кухни по индивидуальным размерам от Вита Кухни: идеальное сочетание стиля и функциональности
Good day! Do you know if they make any plugins to assist with
SEO? I’m trying to get my site to rank for some targeted keywords but
I’m not seeing very good gains. If you know of any please share.
Many thanks! I saw similar text here: List of Backlinks
Good day! Do you know if they make any plugins to assist with Search Engine Optimization? I’m trying to
get my blog to rank for some targeted keywords but I’m not seeing very good
gains. If you know of any please share. Kudos! You can read
similar blog here: Sklep online
Wow, superb weblog format! How lengthy have you been blogging for?
you make running a blog glance easy. The overall glance of your website
is fantastic, let alone the content! You can see similar here sklep
Se você está pensando em usar um aplicativo espião de celular, então você fez a escolha certa.
Abbreviations IM, intramuscularly; IV, intravenously emla cream and priligy tablets 84 Transcription factor AP 2Оі activating enhancer binding protein 2Оі Cell cycle growth proliferation EMP3 NM_001425 1
There hypertension list of medications in alphabetical order pdf is no concept of time in another world, and she doesn t quite understand why in that colorful world, all apple cider vinegar pills blood pressure the people are in such a hurry propecia 5mg
Hong et al Protective effects of the pyrolyzates derived from bamboo against neuronal damage and hematoaggregation order cialis 10 mmol was dissolved in THF 2
site combien d urine en 24h correction presbytie lentilles maladie dГ©gГ©nГ©rative des muscles anatomie petit bassin operation de l urГЁtre svt terminale s gГ©nГ©tique anatomie de la racine des plantes philip stubbes anatomie of abuses yeux de deux couleurs diffГ©rentes buy generic lasix online
nolvadex Given the clinical significance of this we suggest to further review the value of ID interventions on PAB in a prospective study
Average lifetime manure production was estimated at 11, 1287, and 20, 300 lb animal for poultry, swine, and beef cattle, respectively 80 buy cialis online Moreover, functional studies indicate that decidual angiogenesis is mainly regulated by vascular endothelial growth factor A VEGF- A secreted from decidual stromal cells expressing PR; thus, greater expression of VEGF- A corresponds to high PR expression