Re: How to save state of a recursive function?



I suggest you replace the recursive function with a depth-first-search. You
can look at the (free) library I have written for DFS, and/or download the
documentation at http://www.lulu.com/content/1995848.

Your nodes to the DFS can be made Serializable. You save the search by
writing out the last node delivered (which points to its parent, etc, up to
the root). You can reload the node and start the search at the point it
left off by passing the last node as the (new) "root" to a new DFS.


"AliRezaGoogle" <asemoonya@xxxxxxxxx> wrote in message
news:2f9ac6e2-258f-4f5c-bb02-49174ab75128@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Dear Members,
I have written a recursive function. It calls itself recursively. It
is placed inside a thread. So I can easily suspend and resume the
thread to suspend or resume the function as well.

My problem is:

I run the application. Then run the thread. So the function also runs
and makes stacks on stacks and goes deep and deep. I want to save an
arbitrary state of the function (for example the depth or anything
needed to resume). Then close the application. Then restart the
application and reload what I saved and finally resume the thread.

In detail I need to save "process context" of the application
somewhere and reload it again to return to the saved point of app.
It is like hibernating Windows!

Can anybody help me?
Thanks in advance.


.



Relevant Pages

  • Re: How to save state of a recursive function?
    ... Your nodes to the DFS can be made Serializable. ... and makes stacks on stacks and goes deep and deep. ... application and reload what I saved and finally resume the thread. ...
    (microsoft.public.dotnet.languages.csharp)
  • How to save state of a recursive function?
    ... I have written a recursive function. ... So I can easily suspend and resume the ... and makes stacks on stacks and goes deep and deep. ... application and reload what I saved and finally resume the thread. ...
    (microsoft.public.dotnet.languages.csharp)