5 replies
by dljohnston
Your question is kind of difficult to answer because you didn't include any specifics like operating system, what the code needs to do while pausing, language, etc. But, I am always ready to stick my foot in my mouth so here goes:
-if your program just needs to pause it could count in a for-loop or could run a timer.
-if you want input it could do a getch(), scanf() etc.
-if in *NIX you could fork() off another process and wait for its return. or you could start another thread and block until it completes.
-or at a lower level in assembly you could push all pertinent information on the stack and perform a call on a function.
I think I am rambling so I better stop. I hope these at least give you some ideas.
/R/
D
by hsjd_afamily
by epepke
I'm not sure what you mean by pause, and I don't know what you're asking for. If you just mean pause and don't do anything for a while, then most languages have a sleep function, which will block the current thread for a certain amount of time and allow other systems to use the resources.
If you are looking, however, to stop some code and make it leave memory completely, but then go back later and restart, then you're pretty much out of luck. In Unix, you could conceivably cause a core dump and go right back into the core file, but the problem would be the system resources (windows, file pointers, etc). These are usually dynamic and owe their state information to the history of creation. Once they're gone, they're gone. Anyway, restarting a core file would entail restarting the application.
by hsjd_afamily
by hsjd_afamily
This discussion is closed to new replies.
Trending Web Development posts
Sort by Trending