From a1db1c01711784ef6bf8664d178668b80c1561ce Mon Sep 17 00:00:00 2001 From: Jeff Palmucci Date: Mon, 13 Jul 2009 15:16:44 -0400 Subject: [PATCH] Add support for clsql --- README | 4 +++- cl-future.asd | 4 ++++ future-clsql.lisp | 8 ++++++++ future.lisp | 2 +- 4 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 future-clsql.lisp diff --git a/README b/README index f76c7fe..ce32cbc 100644 --- a/README +++ b/README @@ -8,4 +8,6 @@ Interface: (get-future-value ): walk the list structure "expr", replacing any futures with their evaluated values. Blocks if a future is still running. -*total-slaves*: The maximum number of slaves to run at any one time. \ No newline at end of file +*total-slaves*: The maximum number of slaves to run at any one time. + +(terminate-children): Kill all currently running children. diff --git a/cl-future.asd b/cl-future.asd index 3311ec0..fe4c041 100644 --- a/cl-future.asd +++ b/cl-future.asd @@ -14,6 +14,10 @@ :perform (asdf:load-op :after (op c) (if (find-package 'swank) (load (make-pathname :name "future-swank" + :type "lisp" + :defaults *future-path*))) + (if (find-package 'clsql) + (load (make-pathname :name "future-clsql" :type "lisp" :defaults *future-path*))))) diff --git a/future-clsql.lisp b/future-clsql.lisp new file mode 100644 index 0000000..e74c953 --- /dev/null +++ b/future-clsql.lisp @@ -0,0 +1,8 @@ +(in-package :future) + +;; If we are using clsql, make sure to close the connections in the child lest the server get confused. +(defun close-clsql-connections () + (clsql:disconnect) + ) + +(pushnew #'close-clsql-connections *spawn-child-hooks*) diff --git a/future.lisp b/future.lisp index 213d02c..929724a 100644 --- a/future.lisp +++ b/future.lisp @@ -59,7 +59,7 @@ When wait comes around and reaps them, we remove them from the table" (defun terminate-children () - "Kill all currently runnint children" + "Kill all currently running children." (maphash #'(lambda (key value) (with-slots (pid result code) value (ignore-errors (nix:kill (pid value) 9))