From ee564f63003ec1df3c08f25223a4f04eefa3e912 Mon Sep 17 00:00:00 2001 From: Matteo Landi Date: Mon, 31 Jan 2022 18:14:49 +0100 Subject: [PATCH] SBCL: implement THREAD-ATTRIBUTES only for Linux SBCL defines SB-THREAD:THREAD-OS-TID only for Linux, and accessing it from MacOS or Windows will result in a symbol not found error: ; caught ERROR: ; READ error during COMPILE-FILE: ; ; Symbol "THREAD-OS-TID" not found in the SB-THREAD package. ; ; Line: 1716, Column: 40, File-Position: 69208 ; ; Stream: # ;; ;; Error compiling /Users/matteolandi/my-env/opt/slime/swank/sbcl.lisp: ;; COMPILE-FILE returned NIL. ;; --- swank/sbcl.lisp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/swank/sbcl.lisp b/swank/sbcl.lisp index f526ded4b..9194aeefe 100644 --- a/swank/sbcl.lisp +++ b/swank/sbcl.lisp @@ -1720,10 +1720,10 @@ stack." ;; sometimes the name is not a string (e.g. NIL) (princ-to-string (sb-thread:thread-name thread))) + #+linux (defimplementation thread-attributes (thread) (let* ((tid (sb-thread:thread-os-tid thread)) (cpu-time - #+linux (ignore-errors (with-open-file (s (format nil "/proc/self/task/~d/schedstat" tid)) (* (parse-integer (read-line s nil nil) :junk-allowed t)