anchor.diff:                                           :backlog 5
                                            :reuse-address t
                                            #++ :no-delay)
  -           (iolib:set-io-handler event-base
  -                                 control-fd
  -                                 :read (lambda (fd e ex)
  -                                          (declare (ignorable fd e ex))
  -                                          (log:debug "Got lambda to execute on server thread ~a" (eventfd.read control-fd))
  -                                          (loop for m = (dequeue control-mailbox)
  -                                                while m
  -                                                do (funcall m))))
  -           (iolib:set-io-handler event-base
  -                                 (iolib:socket-os-fd socket)
  -                                 :read (let ((true-handler (make-listener-handler
  -                                                            server
  -                                                            socket)))
  -                                         (lambda (&rest rest)
  -                                            (log:debug "There is something to read on fd ~A" (first rest))
  -                                            (apply true-handler rest))))
  -           (handler-case
  -               (event-dispatch event-base)
  -             ;; ... handle errors
  -             ))
  -      (loop :for v :in (server-list-clients server)
  -            :do
  -               (log:debug "cleanup up dropping client ~s" v)
  -               (client-enqueue-read v (list v :dropped))
  -               (client-disconnect v :abort t))
  -      (close event-base)
  -      (close-eventfd control-fd))))
  +           (let ((true-handler (make-listener-handler
  +                                server
  +                                socket)))
  +             (iolib:set-io-handler event-base
  +                                   control-fd
  +                                   :read (lambda (fd e ex)
  +                                            (declare (ignorable fd e ex))
  +                                            (log:debug "Got lambda to execute on server thread ~a" (eventfd.read control-fd))
  +                                            (loop for m = (dequeue control-mailbox)
  +                                                  while m
  +                                                  do (funcall m))))
  +             (iolib:set-io-handler event-base
  +                                   (iolib:socket-os-fd socket)
  +                                   :read
  +                                   (lambda (&rest rest)
  +                                      (log:debug "There is something to read on fd ~A" (first rest))
  +                                      (apply true-handler rest)))
  +             (handler-case
  +                 (event-dispatch event-base)
  +               ;; ... handle errors
  +               ))
  +           (loop :for v :in (server-list-clients server)
  +                 :do
  +                    (log:debug "cleanup up dropping client ~s" v)
  +                    (client-enqueue-read v (list v :dropped))
  +                    (client-disconnect v :abort t))
  +           (close event-base)
  +           (close-eventfd control-fd)))))
   
   (defun setup-execute-in-server-lambda (server)
     (let* ((control-mailbox (make-queue :name (concatenate 'string (server-name server) " server-control")))
  
positive.code: processing is done on the Server Thread, though most user functions
  are thread-safe.
  
  "  
    (log:info "CLWS ~a" (server-name server))
    (setup-execute-in-server-lambda server)
    (log:info "Starting server resources")
  
negative.code:   "Calls RUN-SERVER with given SERVER in separate thread.
  Return SERVER"
    (bt:make-thread
     (lambda ()
        (run-server server))
     :name (server-name server))
    server)
  
  (defun careless-stop (server)
    (log:info "~a: Killing resources~%" (server-name server))
    (kill-all-server-resource-listeners server)
    (log:info "~a: Stopping Server Thread~%" (server-name server))
    (funcall (execute-in-server-lambda server) (lambda () (sb-thread:abort-thread))))
  
  (defun stop-new-messages (server)
    (log:info "~a: Stop accepting new connections" (server-name server))
    (funcall (execute-in-server-lambda server) (lambda ()
                                                  (setf (shutting-down-p server) t)
                                                  (with-hash-table-iterator (next-client (server-clients server))
                                                    (loop
                                                      (multiple-value-bind (next? key client) (next-client)
                                                        (declare (ignorable key))
                                                        (unless next?
                                                          (return))
                                                              ;disable read
                                                        (setf (client-read-closed client) t)
                                                        (client-disable-handler client :read t)))))))
  
  (defun stop-exsiting-clients (server close-code)  
    (log:info "~a: Stop reading new incoming messages and enqueue close frame for all clients" (server-name server))
    (funcall (execute-in-server-lambda server) (lambda ()
                                                  (with-hash-table-iterator (next-client (server-clients server))
                                                    (loop
                                                      (multiple-value-bind (next? key client) (next-client)
                                                        (declare (ignorable key))
                                                        (unless next?
                                                          (return))
                                                        ;;enqueue close
                                                        (write-to-client-close client :code close-code))))))
    (log:info "~a: Waiting until all clients closed" (server-name server))
    (loop
      (when (= 0 (hash-table-count (server-clients server)))
        (return))))
  
  (defun stop-server (server &key soft stop-new-messages-cb close-exsiting-clients-cb (close-code 3502))
    (if soft
        (progn
          (stop-new-messages server)
          (when stop-new-messages-cb
            (funcall stop-new-messages-cb server))
          (stop-exsiting-clients server close-code)
          (when close-exsiting-clients-cb
            (funcall close-exsiting-clients-cb server))
          (careless-stop server))
        (careless-stop server)))
  