SBCL: use GRAB-MUTEX instead of GET-MUTEX on newer SBCLs
[bordeaux-threads.git] / src / pkgdcl.lisp
blob0dd4382a703989e5b96a5293671e0aa062142a20
1 ;;;; -*- indent-tabs-mode: nil -*-
3 (cl:defpackage bordeaux-threads
4 (:nicknames #:bt)
5 (:use #:cl #:alexandria)
6 #+abcl
7 (:import-from :java #:jnew #:jcall #:jmethod)
8 (:export #:thread #:make-thread #:current-thread #:threadp #:thread-name
9 #:start-multiprocessing
10 #:*default-special-bindings* #:*standard-io-bindings*
11 #:*supports-threads-p*
13 #:make-lock #:acquire-lock #:release-lock #:with-lock-held
14 #:make-recursive-lock #:acquire-recursive-lock
15 #:release-recursive-lock #:with-recursive-lock-held
17 #:make-condition-variable #:condition-wait #:condition-notify
19 #:with-timeout #:timeout
21 #:all-threads #:interrupt-thread #:destroy-thread #:thread-alive-p
22 #:join-thread #:thread-yield)
23 (:documentation "BORDEAUX-THREADS is a proposed standard for a minimal
24 MP/threading interface. It is similar to the CLIM-SYS threading and
25 lock support, but for the following broad differences:
27 1) Some behaviours are defined in additional detail: attention has
28 been given to special variable interaction, whether and when
29 cleanup forms are run. Some behaviours are defined in less
30 detail: an implementation that does not support multiple
31 threads is not required to use a new list (nil) for a lock, for
32 example.
34 2) Many functions which would be difficult, dangerous or inefficient
35 to provide on some implementations have been removed. Chiefly
36 these are functions such as thread-wait which expect for
37 efficiency that the thread scheduler is written in Lisp and
38 'hookable', which can't sensibly be done if the scheduler is
39 external to the Lisp image, or the system has more than one CPU.
41 3) Unbalanced ACQUIRE-LOCK and RELEASE-LOCK functions have been
42 added.
44 4) Posix-style condition variables have been added, as it's not
45 otherwise possible to implement them correctly using the other
46 operations that are specified.
48 Threads may be implemented using whatever applicable techniques are
49 provided by the operating system: user-space scheduling,
50 kernel-based LWPs or anything else that does the job.
52 Some parts of this specification can also be implemented in a Lisp
53 that does not support multiple threads. Thread creation and some
54 thread inspection operations will not work, but the locking
55 functions are still present (though they may do nothing) so that
56 thread-safe code can be compiled on both multithread and
57 single-thread implementations without need of conditionals.
59 To avoid conflict with existing MP/threading interfaces in
60 implementations, these symbols live in the BORDEAUX-THREADS package.
61 Implementations and/or users may also make them visible or exported
62 in other more traditionally named packages."))