B4J Tutorial [B4X] Resumable Subs - Sleep / Wait For

Status
Not open for further replies.

Dave O

Well-Known Member
Licensed User
Longtime User
How does a resumable sub using Sleep interact with the activity pausing and resuming?

For example, I'm working on a poker app that uses sleep(250) to pause between each player's bet. Works great while the app is running.

However, if I switch out of my app while it's stepping through the players, then return to the app, the sub doesn't appear to resume.

(If I was using the old method of timers, I would pause/resume the timer when my app was paused/resumed.)

Thanks!
 

LucaMs

Expert
Licensed User
Longtime User
Interesting question (although, as always, it should have been done in a new thread, now I realize this is useful).

Obviously, nobody forbids you to use timers again in situations like these, but, waiting for an Erel's answer, it would be useful to perform some tests: where does the code continue after... [read the question above]?

P.S. I think it will be from a line - unfortunately random - of the code at a higher level than the resumable routine.
 

LucaMs

Expert
Licensed User
Longtime User
Interesting question (although, as always, it should have been done in a new thread
Please start a new thread for this question.
Given that for the moment a new thread has not been opened, I add only this post, about this topic, because I did a little test, I created a loop with "Sleep" inside, paused the app, resumed it and the loop continued in background.
 
Last edited:
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…