Implement APIv2.
[bordeaux-threads.git] / apiv2 / pkgdcl.lisp
blob71bf70652778afa67f7405b01dd6b675572c8869
1 ;;;; -*- Mode: LISP; Syntax: ANSI-Common-lisp; Base: 10; Package: CL-USER -*-
2 ;;;; The above modeline is required for Genera. Do not change.
4 (defpackage :bordeaux-threads-2
5 (:nicknames :bt2)
6 (:use :common-lisp :alexandria :global-vars)
7 #+abcl
8 (:import-from :java #:jnew #:jcall #:jclass #:jmethod)
9 #+sbcl
10 (:import-from :sb-ext #:timeout)
12 ;; Threads
13 (:export
14 #:thread
15 #:make-thread
16 #:current-thread
17 #:threadp
18 #:thread-name
19 #:thread-native-thread
20 #:start-multiprocessing
21 #:*default-special-bindings*
22 #:*standard-io-bindings*
23 #:*supports-threads-p*
24 #:bordeaux-threads-error
25 #:not-implemented
26 #:implemented-p
27 #:implemented-p*
29 #:all-threads
30 #:interrupt-thread
31 #:signal-in-thread
32 #:warn-in-thread
33 #:error-in-thread
34 #:destroy-thread
35 #:thread-alive-p
36 #:join-thread
37 #:abnormal-exit
38 #:thread-yield)
40 ;; Locks
41 (:export
42 #:lock
43 #:lockp
44 #:recursive-lock
45 #:recursive-lock-p
46 #:lock-name
47 #:lock-native-lock
48 #:native-lock
49 #:native-lock-p
51 #:make-lock
52 #:acquire-lock
53 #:release-lock
54 #:with-lock-held
56 #:make-recursive-lock
57 #:acquire-recursive-lock
58 #:release-recursive-lock
59 #:with-recursive-lock-held)
61 ;; Condition variables
62 (:export
63 #:make-condition-variable
64 #:condition-wait
65 #:condition-notify
66 #:condition-broadcast)
68 ;; Semaphores
69 (:export
70 #:semaphore
71 #:semaphorep
72 #:make-semaphore
73 #:signal-semaphore
74 #:wait-on-semaphore)
76 ;; Atomic operations
77 (:export
78 #:make-atomic-integer
79 #:atomic-integer-compare-and-swap
80 #:atomic-integer-decf
81 #:atomic-integer-incf
82 #:atomic-integer-value)
84 ;; Timeouts
85 (:export
86 #:timeout
87 #:with-timeout)
89 (:documentation "BORDEAUX-THREADS is a proposed standard for a minimal
90 MP/threading interface. It is similar to the CLIM-SYS threading and
91 lock support, but for the following broad differences:
93 1) Some behaviours are defined in additional detail: attention has
94 been given to special variable interaction, whether and when
95 cleanup forms are run. Some behaviours are defined in less
96 detail: an implementation that does not support multiple
97 threads is not required to use a new list (nil) for a lock, for
98 example.
100 2) Many functions which would be difficult, dangerous or inefficient
101 to provide on some implementations have been removed. Chiefly
102 these are functions such as thread-wait which expect for
103 efficiency that the thread scheduler is written in Lisp and
104 'hookable', which can't sensibly be done if the scheduler is
105 external to the Lisp image, or the system has more than one CPU.
107 3) Unbalanced ACQUIRE-LOCK and RELEASE-LOCK functions have been
108 added.
110 4) Posix-style condition variables have been added, as it's not
111 otherwise possible to implement them correctly using the other
112 operations that are specified.
114 Threads may be implemented using whatever applicable techniques are
115 provided by the operating system: user-space scheduling,
116 kernel-based LWPs or anything else that does the job.
118 To avoid conflict with existing MP/threading interfaces in
119 implementations, these symbols live in the BORDEAUX-THREADS-2 package.
120 Implementations and/or users may also make them visible or exported
121 in other more traditionally named packages."))