Add a function to query the name of a thread

This commit is contained in:
Renaud Casenave-Péré 2014-08-13 18:15:12 +09:00
parent c213413fb9
commit 230566830d

View file

@ -7,7 +7,7 @@
(defpackage stoe.thread
(:nicknames :thread)
(:use :cl)
(:export :make-thread :join-thread :thread-alive-p :current-thread
(:export :make-thread :join-thread :thread-alive-p :current-thread :thread-name
:make-mutex :grab-mutex :release-mutex
:with-mutex :with-recursive-lock))
(in-package :stoe.thread)
@ -34,6 +34,11 @@ thread function."
#+(and sbcl sb-thread) sb-thread:*current-thread*
#-(and sbcl sb-thread) (error "For now, only sbcl is supported."))
(defun thread-name (thread)
"Return the name of THREAD."
#+(and sbcl sb-thread) (sb-thread:thread-name thread)
#-(and sbcl sb-thread) (error "For now, only sbcl is supported."))
(defun make-mutex (&optional name)
"Create a mutex."
#+(and sbcl sb-thread) (sb-thread:make-mutex :name name)