How do I pause a thread indefinitely? im creating a game and i need a thread to be paused when the user pauses the game and the thread will resume when the user unpauses the game. =) im using thread.sleep right now but it requires an integer to determine how long it will pause, but since i dont know how long the user is gonna pause the game, i think that method wont do me any good.
esy928
0
Light Poster
Recommended Answers
Jump to Postthis might be an option
public static void pauze(){ while(!isContinue()){ //keep the duration small, so the game will be resumed shortly after // the user presses resume sleep(500); } } public static boolean isContinue(){ boolean returnVal = false; // this method checks in the rest of your …
Jump to Postthis might be an option
public static void pauze(){ while(!isContinue()){ //keep the duration small, so the game will be resumed shortly after // the user presses resume sleep(500); } } public static boolean isContinue(){ boolean returnVal = false; // this method checks in the rest of your code, …
All 8 Replies
stultuske
1,116
Posting Maven
Featured Poster
esy928
0
Light Poster
Alex Edwards
321
Posting Shark
ankurgecr
0
Newbie Poster
NormR1
563
Posting Sage
Team Colleague
ankurgecr
0
Newbie Poster
stultuske
1,116
Posting Maven
Featured Poster
NormR1
563
Posting Sage
Team Colleague
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.