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:
sub doMyThing() {
doStuff;
waitFor( condition);
doMoreStuff;
}
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 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:
sub doMyThing() {
waitWrapper( condition) {
doStuff;
} waitFor( condition);
doMoreStuff;
}
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
I'm looking for any other thoughts on this.
Rich
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.