mirror of
https://github.com/rabbibotton/clog.git
synced 2025-12-06 02:30:42 -08:00
Now all threads have their names.
It is better to pass :name parameter to every bt:make-thread call
becaise otherwise all threads in system will be like this:
#<SB-THREAD:THREAD "Anonymous thread" RUNNING {1006295ED3}>
Anonymous threads make debugging harder :(
This commit is contained in:
parent
ac9fea0799
commit
b6e1ce9650
2 changed files with 14 additions and 6 deletions
|
|
@ -153,7 +153,9 @@ the default answer. (Private)"
|
|||
(format nil "clog['connection_id']=~A" id))
|
||||
(bordeaux-threads:make-thread
|
||||
(lambda ()
|
||||
(funcall *on-connect-handler* id))))))
|
||||
(funcall *on-connect-handler* id))
|
||||
:name (format nil "CLOG connection ~A"
|
||||
id)))))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;
|
||||
;; handle-message ;;
|
||||
|
|
@ -166,16 +168,21 @@ the default answer. (Private)"
|
|||
(when *verbose-output*
|
||||
(format t "~A Ping~%" id)))
|
||||
((equal (first ml) "E")
|
||||
(let ((em (ppcre:split " " (second ml) :limit 2)))
|
||||
(let* ((em (ppcre:split " " (second ml) :limit 2))
|
||||
(event-id (first em))
|
||||
(data (second em)))
|
||||
(when *verbose-output*
|
||||
(format t "Channel ~A Hook ~A Data ~A~%"
|
||||
id (first em) (second em)))
|
||||
id event-id data))
|
||||
(bordeaux-threads:make-thread
|
||||
(lambda ()
|
||||
(let* ((event-hash (get-connection-data id))
|
||||
(event (when event-hash
|
||||
(gethash (first em) event-hash))))
|
||||
(when event (funcall event (second em))))))))
|
||||
(gethash event-id event-hash))))
|
||||
(when event
|
||||
(funcall event data))))
|
||||
:name (format nil "CLOG event handler ~A"
|
||||
event-id))))
|
||||
(t
|
||||
(when *verbose-output*
|
||||
(format t "~A ~A = ~A~%" id (first ml) (second ml)))
|
||||
|
|
|
|||
|
|
@ -48,7 +48,8 @@
|
|||
(setf (text mover) ")-o-(")
|
||||
(sleep .2)
|
||||
(setf (text mover) "(-o-)"))
|
||||
(setf (inner-html mover) "<H1>GAME OVER</H1>")))
|
||||
(setf (inner-html mover) "<H1>GAME OVER</H1>"))
|
||||
:name "Dragon event loop")
|
||||
;; Check of browser still connected while running game loop
|
||||
(loop
|
||||
(unless (validp body)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue