Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a persistent state table that uses a destructor upon reloads #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kstrafe
Copy link

@kstrafe kstrafe commented Nov 9, 2017

There is a need for semi-persistence in some cases. Especially threads may make use
of this functionality: the thread needs to be reloaded but its previous instance must
be killed. For this we need to persist the variable until after the reload and then
kill the thread

An example:

(make-persistent-state-destructor 'name (lambda () (thread (lambda ()
                                          (let loop ()
                                            (sleep 1)
                                            (displayln (current-seconds))
                                            (loop)))))
                                  kill-thread)

On my webserver I have a thread that performs certain IO operations periodically, however,
I want it to be reloaded (and the old instance killed) whenever I change a file. This would
be a very good addition to the library.

There is a need for semi-persistence in some cases. Especially threads may make use
of this functionality: the thread needs to be reloaded but its previous instance must
be killed. For this we need to persist the variable until after the reload and then
kill the thread

An example:

    (make-persistent-state-destructor 'name (lambda () (thread (lambda ()
                                              (let loop ()
                                                (sleep 1)
                                                (displayln (current-seconds))
                                                (loop)))))
                                      kill-thread)

On my webserver I have a thread that performs certain IO operations periodically, however,
I want it to be reloaded (and the old instance killed) whenever I change a file. This would
be a very good addition to the library.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant