Skip to content

Instantly share code, notes, and snippets.

@phoe
Created February 25, 2018 10:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phoe/6eefaee33a8ae1ef924547221ee64597 to your computer and use it in GitHub Desktop.
Save phoe/6eefaee33a8ae1ef924547221ee64597 to your computer and use it in GitHub Desktop.
Thread PIDs on SBCL on Linux
;; NOTE: absolutely non-portable
* (sb-alien:alien-funcall
(sb-alien:extern-alien "syscall" (function sb-alien:unsigned int)) 186)
3288 ;; this is the correct PID of the main SBCL thread
* (bt:make-thread (lambda ()
(sb-alien:alien-funcall
(sb-alien:extern-alien "syscall" (function sb-alien:unsigned int)) 186)))
#<SB-THREAD:THREAD "Anonymous thread" FINISHED values: 3412 {100364B363}>
* (bt:join-thread *)
3412 ;; 3412 is the correct PID of the SBCL thread that was created to serve that request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment