Package bordeaux-threads
bordeaux-threads is a proposed standard for a minimal
MP/threading interface.
About This PackageIntroduction Thread Creation Resource contention: locks and recursive locks Resource contention: condition variables Introspection/debugging OverviewAuthorBased on original Bordeaux-MP spec by Dan Barlow <dan@telent.net>Contributors:
VersionThis is a documentation of Version 0.8.2.Homepagehttp://common-lisp.net/project/bordeaux-threads/Mailing Listbordeaux-threads-devel for developersbordeaux-threads-announce for announcements bordeaux-threads-ticket for bug updates DownloadReleases are available at http://common-lisp.net/project/bordeaux-threads/releases/Source CodeYou can browse the repository or download the current development tree at common-lisp.net or gitoriousDependenciesbordeaux-threads needs the package alexandria.LicensePermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Introductionbordeaux-threads is similar to the CLIM-SYS threading and lock support, but for the following broad differences:
Some parts of this specification can also be implemented in a Lisp that does not support multiple threads. Thread creation and some thread inspection operations will not work, but the locking functions are still present (though they may do nothing) so that thread-safe code can be compiled on both multithread and single-thread implementations without need of conditionals. To avoid conflict with existing MP/threading interfaces in implementations, these symbols live in the bordeaux-threads package. Implementations and/or users may also make them visible or exported in other more traditionally named packages. Thread Creation Creates and returns a thread named name, which will call the function function with no arguments: when function returns,
the thread terminates. ... Returns the thread object for the calling thread. ... Returns true if object is a thread, otherwise nil. Returns the name of the thread, as supplied to make-thread. Resource contention: locks and recursive locksCreates a lock (a mutex) whose name is name. ... Acquire the lock lock for the calling thread. ... Release lock. ... Create and return a recursive lock whose name is name. ... As for acquire-lock, but for recursive locks. Release the recursive lock. ... Resource contention: condition variablesA condition variable provides a mechanism for threads to put themselves to sleep while waiting for the state of something to change, then to be subsequently woken by another thread which has changed the state.A condition variable must be used in conjunction with a lock to protect access to the state of the object of interest. The procedure is as follows: Suppose two threads A and B, and some kind of notional event channel C. A is consuming events in C, and B is producing them. CV is a condition-variable
Allows other threads to run. ... Returns a new condition-variable object for use with condition-wait and condition-notify. Notify at least one of the threads waiting for condition-variable. ... Introspection/debuggingThe following functions may be provided for debugging purposes, but are not advised to be called from normal user code.Returns a sequence of all of the threads. This may not be freshly-allocated, so the caller should not modify it. Interrupt thread and cause it to evaluate function
before continuing with the interrupted path of execution. ... Returns true if thread is alive, that is, if destroy-thread has not been called on it. Wait until thread terminates. If thread has already terminated, return immediately. | Exported Symbol Index
|