Skip to content
MPGHThe Dark Arts
/
RegisterLog in
Forum
Community
What's NewLatest posts across the boardTrendingHottest threads right nowSubscribedThreads you follow
Discussion
GeneralIntroductionsEntertainmentDebate FortFlaming & Rage
Board
News & AnnouncementsMPGH TimesSuggestions & HelpGiveaways
More Sections
Art & Graphic DesignProgrammingHackingCryptocurrency
Hacks & Cheats
Games
ValorantCS2 / CS:GOCall of Duty / WarzoneFortniteApex LegendsEscape From Tarkov
+14 moreLeague of LegendsGTA VMinecraftRustROTMGBattlefieldTroveBattleOnCombat ArmsCrossFireBlackshotRuneScapeDayZDead by Daylight
Resources
Game Hacking TutorialsReverse EngineeringGeneral Game HackingAnti-CheatConsole Game Hacking
Tools
Game Hacking ToolsTrainers & CheatsHack/Release NewsNew
Submit a release →Share your cheat, tool, or config with the community.
AINEW
AI Tools
General & DiscussionPrompt EngineeringLLM JailbreaksHotAI Agents & AutomationLocal / Open Models
AI × Gaming
AI Aimbots & VisionML Anti-CheatGame Bots & Automation
Create
AI Coding / Vibe CodingAI Art & MediaAI Voice & TTS
The AI frontier →Where game hacking meets modern machine learning. Jump in.
Marketplace
Buy & Sell
SellingBuyingTradingUser Services
Trust & Safety
Middleman LoungeMarketplace TalkVouch Copy Profiles
Money
Cryptocurrency TalkCurrency ExchangeWork & Job Offers
Start selling →List accounts, services, and goods. Use the middleman to trade safe.
MPGH The Dark Arts

A community for offensive security research, reverse engineering, and AI.

Community

ForumMarketplaceSearch

Account

RegisterLog in

Legal

Privacy PolicyForum RulesHelp & FAQ
© 2026 MPGH · All rights reserved.Built by the community, for the community. For educational purposes onlyContent is shared for security research and education — we don't condone illegal use. You're responsible for complying with applicable laws. Use at your own risk.
Home › Forum › Programming › C++/C Programming › Delay in C++?

Delay in C++?

Posts 1–7 of 7 · Page 1 of 1
danny_moon
danny_moon
Delay in C++?
hello guys i havent been on much on MPGH because of school and more.. but i wanted to ask, how i make a delay? like let it wait for 3 secs then continue.... i know its simple but i forgot and im not the one that likes to search =D (I search for different things) i know it was something like Sleep 3; or something i just cant remember
#1 · 16y ago
radnomguywfq3
radnomguywfq3
Sleep(ms);

ms is the amount of seconds to sleep.
Sleep Function (Windows)

There are like a million ways to do it.
#2 · 16y ago
why06
why06
You would have to do it like: sleep(3000);


Hmmm... I always had a question about this. Does sleep stop the entire execution from running? Such as if I used sleep in a loop of different functions. Let me show you:
Code:
while(true)
{
void function1(){something;};
void function2(){something;};
void function3(){sleep(3000);};
void function4(){something;};
}
Would the other functions still execute while function 3 is sleeping, because I would imagine they would not and it seems this could cause some problems. if you needed other functions to be regularly updated during the sleep() cycle.
#3 · 16y ago
LE
LegendaryAbbo
Oh I thought it would be like function 1,2,3 would go then it would wait 3000 and then function 4 would
#4 · 16y ago
radnomguywfq3
radnomguywfq3
Quote Originally Posted by why06 View Post
You would have to do it like: sleep(3000);


Hmmm... I always had a question about this. Does sleep stop the entire execution from running? Such as if I used sleep in a loop of different functions. Let me show you:
Code:
while(true)
{
void function1(){something;};
void function2(){something;};
void function3(){sleep(3000);};
void function4(){something;};
}
Would the other functions still execute while function 3 is sleeping, because I would imagine they would not and it seems this could cause some problems. if you needed other functions to be regularly updated during the sleep() cycle.
If they're running in the same thread, yes. In simpler terms, if you haven't forked or created a new thread knowingly, then yes it will. I'd explain more but it'd require a whole article on threads, and how Windows does multi-threading.

This is solved by either writing a multi-threaded application, or, instead of performing a sleep, comparing the current time to the last time the function was executed to see if it should execute or just return.
#5 · 16y ago
why06
why06
Quote Originally Posted by Jetamay View Post
This is solved by either writing a multi-threaded application, or, instead of performing a sleep, comparing the current time to the last time the function was executed to see if it should execute or just return.
Oh that sounds like a much better idea. I think I made my own sleep function a while back, by accessing the system clock. I never thought to use it to return... o_O
#6 · 16y ago
radnomguywfq3
radnomguywfq3
Quote Originally Posted by why06 View Post
Oh that sounds like a much better idea. I think I made my own sleep function a while back, by accessing the system clock. I never thought to use it to return... o_O
By return I mean (pseudo code)
Code:
if(lastTimeChk+sleepTime > checkCurTime()) return 0; //End execution of method here

rest of the method's code
#7 · 16y ago
Posts 1–7 of 7 · Page 1 of 1

Post a Reply

Similar Threads

  • Hacks DelayedBy Dave84311 in Hack/Release News
    31Last post 19y ago
  • Delayed GunZ PostBy NotSorry in Gunz General
    0Last post 18y ago
  • [Release...kinda]Delay GodmodeBy tzie13 in Combat Arms Hacks & Cheats
    44Last post 18y ago
  • No Delay HackBy svegerot in MapleStory Hacks, Cheats & Trainers
    0Last post 17y ago
  • Delay on Ghostmode for PublicBy dr1nkm1lk in Combat Arms Hacks & Cheats
    11Last post 17y ago

Tags for this Thread

#delay