[slime-devel] sbcl threads
Gábor Melis
mega at hotpop.com
Mon Jun 20 13:46:56 UTC 2005
Recently sbcl switched to using pthreads if it is built with thread support.
Sbcl cvs head has a thread-os-thread-slot instead of thread-pid-slot. Its
value is a pid in non-threaded builds, and a pthread_t otherwise. Now,
pthread_t is an unsigned long on linux/nptl and the high bits are really used
so communication with emacs breaks down: the id of the startup thread on my
system does not fit into an elisp integer:
1098623904 => 24882080
The patch below adds a mising a thread state and works with os-thread instead
of pid. However, the (unsigned-byte 32) communication problem is still there.
Index: swank-sbcl.lisp
===================================================================
RCS file: /project/slime/cvsroot/slime/swank-sbcl.lisp,v
retrieving revision 1.134
diff -u -r1.134 swank-sbcl.lisp
--- swank-sbcl.lisp 11 Jun 2005 16:22:23 -0000 1.134
+++ swank-sbcl.lisp 20 Jun 2005 13:33:38 -0000
@@ -1117,7 +1117,8 @@
(0 :running)
(1 :stopping)
(2 :stopped)
- (3 :dead)))
+ (3 :dead)
+ (4 :starting)))
(defimplementation thread-status (thread)
(string (%thread-state thread)))
@@ -1136,8 +1137,9 @@
(let ((pids (sb-sys:without-gcing
(sb-thread::mapcar-threads
(lambda (sap)
- (sb-sys:sap-ref-32 sap (* sb-vm:n-word-bytes
- sb-vm::thread-pid-slot)))))))
+ (sb-sys:sap-ref-32 sap
+ (* sb-vm:n-word-bytes
+ sb-vm::thread-os-thread-slot)))))))
(remove :dead pids :key #'%thread-state)))
(defimplementation interrupt-thread (thread fn)
Cheers, Gábor Melis
More information about the slime-devel
mailing list