P is for Practical | |
PerlMonks |
Restarting Threadsby Helter (Chaplain) |
on Apr 24, 2006 at 14:24 UTC ( [id://545287]=perlquestion: print w/replies, xml ) | Need Help?? |
Helter has asked for the wisdom of the Perl Monks concerning the following question:
This is a complicated question, in a large environment so bear with me. :) I work on a large project that mixes 5 languages in a single executable. The front end interface uses Perl parsing to do all the user input. Our project requires save-restore functionality. The users will be able to provide functions that get called and need to run over time. For example the user may write something like this: The function doMyThing gets spawned as a thread that will pause/yield when the waitFor() function is hit. The problem is when we do a system wide save() when the waitFor() is going. I'm trying to figure out a way that we can then later restore() and continue processing.
We can provide a function to the users that hides some "magic" in there that we may be able to use to provide this functionality, but I'm unsure the best way to do this.
I'm looking for any other thoughts on this.I have given this some thought, we would like to make the interface to the users as simple as possible while leaving as much power in the users hands. One way to make the users use some sort of wrapper functions, which we would like to avoid if possible, so we can later skip back to the waiting: Then we use some sort of variables to determine which waits we have hit and where we can jump back to after the restore(). Edit: I was informed that save() restore() is not a common concept. In running our simulations we need the ability to simulate to a point and save the state of the run. This includes all variables and state. Then later we can jump to that point without spending the time computing the state. This saves us hours of time when debugging a problem and is an essential tool for us. EndEdit Rich
Back to
Seekers of Perl Wisdom
|
|