anchor.diff:  
   (load "./config.lisp") ;; *hosts* *port* *debug*
   
  +;; global vars
   (defparameter *global-socket* (socket-listen *host* *port*))
  -
   (defparameter *clients* nil)
  -(defparameter *client-read-threads* nil)
   (defparameter *messages-stack* nil)
   (defparameter *messages-log* nil)
  +(defparameter *commands-names* '("/users" "/help" "/log" "/quit"))
   
  +;; thread control
   (defvar *message-semaphore* (sb-thread:make-semaphore :name "message semaphore" :count 0))
   (defvar *message-mutex* (sb-thread:make-mutex :name "message mutex"))
   (defvar *client-mutex* (sb-thread:make-mutex :name "client list mutex"))
  -(defvar *client-read-mutex* (sb-thread:make-mutex :name "client read mutex"))
   
  +
  +
  +(defstruct message from content time)
   
   (defstruct client name socket)
   
  -(defstruct message from content time)
  +
  +(defun client-stream (c)
  +  (socket-stream (client-socket c)))
   
   
   (defun debug-format (&rest args)
     (if *debug*
         (apply #'format args)))
   
  +
   (defun get-time ()
     (multiple-value-bind (second minute hour)
         (get-decoded-time)
       (format nil "~2,'0d:~2,'0d:~2,'0d" hour minute second)))
  -
  -(defun client-stream (c)
  -  (socket-stream (client-socket c)))
   
   
   (defun formated-message (message)
  
positive.code:                                *clients*)))
    (debug-format t "Deleted user ~s ~%" (client-name client)))
  
  
  (defun client-reader-routine (client)
    (loop for message = (read-line (client-stream client))
          while (not (equal message "/quit"))
          when (> (length message) 0)
            do (push-message (client-name client)
                             message)
          finally (client-delete client)))
  
  (defun client-reader (client)
    (handler-case (client-reader-routine client)
      (end-of-file () (client-delete client))))
  
  
  (defun send-message (client message)
    (let ((stream (client-stream client)))
      (write-line message stream)
      (finish-output stream)))
  
  
  (defun create-client (connection)
  
negative.code:           (message-content message)))
  
  
  (defun command-message (content)
    (let* ((from "@server")
           (time (get-time))
           (message (make-message :from from :content content :time time)))
      (formated-message message)))
  
  
  ;; user commands prefixed with /
  (defun /users ()
    (command-message (format nil "~{~a~^, ~}" (mapcar #'client-name *clients*))))
  
  
  (defun /help ()
    (command-message (format nil "~{~a~^, ~}" *commands-names*)))
  
  
  (defun /log (&optional (depth 15))
    (format nil "~{~a~^~%~}" (reverse (subseq *messages-log* 0
                                              (min depth (length *messages-log*))))))
  
  
  (defun push-message (from content)
    (sb-thread:with-mutex (*message-mutex*)
      (push (make-message :from from
                          :content content
                          :time (get-time))
            *messages-stack*)
      (sb-thread:signal-semaphore *message-semaphore*)))
  
  (defun client-delete (client)
    (push-message "@server"
  