actors: Add cleanup facility to run-hive.
authorChristopher Allan Webber <cwebber@dustycloud.org>
Mon, 2 Jan 2017 17:40:42 +0000 (11:40 -0600)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Mon, 2 Jan 2017 17:40:42 +0000 (11:40 -0600)
commita5c16530d2e253c0d56143c5337740b1f7a403ed
tree241c392453ee9c8cfd1fa6a718c095ba7cbae956
parentf0863bf36133288ed55eb97a3732d581be45c231
actors: Add cleanup facility to run-hive.

* 8sync/actors.scm (build-actions): Moved location to be before <actor>
for compiler reasons.
(<actor>): Add *cleanup* default action to all actors, which does
nothing by default.
(<hive>, hive-handle-cleanup-all): New cleanup method, which gives
all actors still in the registry a chance to clean up.
(make-hive): Have the hive register itself to itself.
(run-hive): Now run in a dynamic-wind, and call run-hive-cleanup when
we're done.
(run-hive-cleanup): New variable.

* tests/test-actors.scm: New test to make sure cleanup is run.
8sync/actors.scm
tests/test-actors.scm