加入比较短时间的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占用,而且动画效果甚至更舒服了:
india online pharmacy: п»їlegitimate online pharmacies india – Online medicine order
best ed treatment pills: natural pills for ed – online drugs
indian pharmacy: buy prescription drugs from india – indian pharmacy online
His form for Metz earned him a recall to the Japan nationwide staff, the place he went on to reclaim the primary jersey.
http://mexicanpharm1st.com/# pharmacies in mexico that ship to usa
https://drugs1st.store/# 100mg viagra without a doctor prescription
What’s ATM entry like in USA & Canada?
buy prescription drugs from india: india online pharmacy – online shopping pharmacy india
100mg viagra without a doctor prescription: drugs prices – ed pills
erection pills viagra online: how to cure ed naturally – buy cheap prescription drugs online
reputable indian pharmacies india online pharmacy top 10 pharmacies in india
mexican drugstore online: buying prescription drugs in mexico – reputable mexican pharmacies online
ed problems treatment: ed pills comparison – buy prescription drugs from canada cheap
Online medicine home delivery: online shopping pharmacy india – best india pharmacy
http://mexicanpharm1st.com/# mexican drugstore online
best online pharmacies in mexico: mexican online pharmacies prescription drugs – buying from online mexican pharmacy
http://drugs1st.store/# cure for ed
mexican rx online: mexican border pharmacies shipping to usa – purple pharmacy mexico price list
http://mexicanpharm1st.com/# mexico drug stores pharmacies
ed in young men ed treatment options prescription drugs without prior prescription
http://mexicanpharm1st.com/# purple pharmacy mexico price list
mexican mail order pharmacies: mexican drugstore online – buying prescription drugs in mexico online
best online pharmacies in mexico mexican pharmaceuticals online п»їbest mexican online pharmacies
Сервисный центр предлагает качественый ремонт стиральной машины asko выездной ремонт стиральных машин asko
online pharmacy india: top online pharmacy india – india pharmacy
buy prescription drugs from canada: ed cures that actually work – ed medications list
mexico drug stores pharmacies: buying prescription drugs in mexico – best online pharmacies in mexico
cheapest online pharmacy india: india pharmacy – buy medicines online in india
top 10 pharmacies in india: indian pharmacy online – india online pharmacy
pharmacy website india: indian pharmacy online – mail order pharmacy india
medication from mexico pharmacy: reputable mexican pharmacies online – medicine in mexico pharmacies
buying prescription drugs in mexico online: reputable mexican pharmacies online – mexico pharmacies prescription drugs
http://mexicanpharm1st.com/# mexican drugstore online
https://drugs1st.store/# natural help for ed
mail order pharmacy india п»їlegitimate online pharmacies india indian pharmacies safe
pharmacies in mexico that ship to usa: mexican rx online – mexican mail order pharmacies
https://mexicanpharm1st.com/# medication from mexico pharmacy
india pharmacy mail order: top 10 pharmacies in india – Online medicine home delivery
best drug for ed: best medicine for ed – herbal ed remedies
This just made my day! Thank you!
mexican border pharmacies shipping to usa: п»їbest mexican online pharmacies – mexican pharmaceuticals online
They don’t consider it with distinctions,’ says novelist Marina Budhos.
cheap medications: medication drugs – canadian pharmacy
best online pharmacy india top online pharmacy india reputable indian pharmacies
pharmacies in mexico that ship to usa: mexican pharmaceuticals online – buying from online mexican pharmacy
reputable mexican pharmacies online purple pharmacy mexico price list mexican border pharmacies shipping to usa
пинап кз: пин ап кз – пин ап кз
пин ап казино: пинап кз – пинап
canl? casino siteleri casino sitesi h?zl? casino
https://1wintr.fun/# canl? casino siteleri
пин ап казино