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