anchor.diff:        (format t "Destroying worker: ~S~%" (bt:thread-name worker))
         (bt:destroy-thread worker)))
     (setf (workers pool) (list))
  +
  +  (format t "Destroying worker sockets.~%")
  +  (when-let (sock (work-sock pool))
  +    (zmq:close (work-sock pool)))
  +  (when-let (sock (result-sock pool))
  +    (close sock))
  +
     (format t "TODO: Fail remaining callbacks in ~A~%" (work pool)))
   
   ;;;; Methods
   (defmethod make-worker ((pool pool) &optional (id :somekind))
     (flet ((work-fn ()
  -           ;; TODO: Uh, no
  -           (do () (nil) (sleep 1))))
  +           (zmq:with-sockets ((work (context pool) :pull)
  +                              (result (context pool) :pub))
  +             (zmq:connect work (work-address pool))
  +             (zmq:connect result (result-address pool))
  +
  +             (format t "Worker: ~S waiting to work.~%" (bt:thread-name (bt:current-thread)))
  +             (do* ((job-id (zmq:recv! work :string) (zmq:recv! work :string))
  +                   (job (gethash job-id (work pool)) (gethash job-id (work pool))))
  +                  (nil)
  +               (format t "Worker: ~S got job-id ~S => ~S~%" (bt:thread-name (bt:current-thread)) job-id job)))))
  +
       (bt:make-thread #'work-fn :name (format nil "pool-worker[~S]" id))))
   
   
  
positive.code:   (:documentation "Return a running thread ready to do work for the given pool."))
  
  ;;;; Lifecycle methods
  (defmethod initialize-instance :after ((pool pool) &key)
    (format t "TODO: Initializing pool: ~A~%" pool)
    (dotimes (worker-id (size pool))
      (let ((worker (make-worker pool worker-id)))
        (format t "Adding worker ~a: ~S~%" worker-id worker)
  
negative.code: ;; Classes
  ;;; Pool Class
  (defclass pool (emitter)
    ((context :initform (zmq:init 0)
              :reader context)
  
     (work-address :initform (format nil "inproc://threadpool-work-~A" (uuid:make-v4-uuid))
                   :reader work-address)
     (work-sock :accessor work-sock)
  
     (result-address :initform (format nil "inproc://threadpool-result-~A" (uuid:make-v4-uuid))
                     :reader result-address)
     (result-sock :accessor result-sock)
  
     (size :initform 2
           :initarg :size
           :reader size
           :documentation "The number of pool workers.")
  