Split system BORDEAUX-THREADS-TEST into its own .asd
[bordeaux-threads.git] / src / mcl.lisp
blob5e757c2ed03412380be9449aadbb9cdb67487e80
1 ;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; indent-tabs-mode: nil -*-
3 #|
4 Copyright 2006, 2007 Greg Pfeil
6 Distributed under the MIT license (see LICENSE file)
7 |#
9 (in-package #:bordeaux-threads)
11 ;;; Thread Creation
13 (defun %make-thread (function name)
14 (ccl:process-run-function name function))
16 (defun current-thread ()
17 ccl:*current-thread*)
19 (defun threadp (object)
20 (ccl:processp object))
22 (defun thread-name (thread)
23 (ccl:process-name thread))
25 ;;; Resource contention: locks and recursive locks
27 (defun make-lock (&optional name)
28 (ccl:make-lock (or name "Anonymous lock")))
30 (defmacro with-lock-held ((place) &body body)
31 `(ccl:with-lock-grabbed (,place) ,@body))
33 (defun thread-yield ()
34 (ccl:process-allow-schedule))
36 ;;; Introspection/debugging
38 (defun all-threads ()
39 ccl:*all-processes*)
41 (defun interrupt-thread (thread function)
42 (ccl:process-interrupt thread function))
44 (defun destroy-thread (thread)
45 (signal-error-if-current-thread thread)
46 (ccl:process-kill thread))
48 (mark-supported)