The trivial-object-lock Reference Manual

Table of Contents

Next: , Previous: , Up: (dir)   [Contents][Index]

The trivial-object-lock Reference Manual

This is the trivial-object-lock Reference Manual, version 0.3.2, generated automatically by Declt version 2.4 patchlevel 1 "Will Decker" on Mon Jul 29 16:51:31 2019 GMT+0.


Next: , Previous: , Up: Top   [Contents][Index]

1 Introduction

Trivial Object Lock Manual

[in package TRIVIAL-OBJECT-LOCK]

pipeline status Quicklisp coverage report

Description

This library allows locking access to any SYMBOL on two different levels: FULL-LOCK and PARTIAL-LOCK.

A FULL-LOCK blocks any access to the SYMBOL.
A PARTIAL-LOCK blocks access to a property of the SYMBOL. A property can be a slot (in the case of a class instance) or any other SYMBOL.

PARTIAL-LOCKs allow simultameous access to different properties of a SYMBOL, while being superseeded by any FULL-LOCK.

Installing trivial-object-lock

This project is available in the latest QuickLisp distribution, so installing it is reduced to calling:

(ql:quickload :trivial-object-lock)

Working Example

The following code demonstrates the use-case for this library.
Note: The sequence '=>' indicates the result from evaluating the previous expression.

  (defclass something ()
    (a-slot
     another-slot))

(let ((result '())
       (object (make-instance 'something)))

    (acquire-lock object 'a-slot)
    
    (bordeaux-threads:make-thread #'(lambda () (with-object-lock-held (object :property 'another-slot) (sleep 1) (push 'A result))))
    (bordeaux-threads:make-thread #'(lambda () (with-object-lock-held (object) (sleep 1) (push 'B result))))
    (bordeaux-threads:make-thread #'(lambda () (with-object-lock-held (object :property 'a-slot) (sleep 1) (push 'C result))))
    (bordeaux-threads:make-thread #'(lambda () (with-object-lock-held (object :property 'another-slot) (sleep 1) (push 'D result))))
    (bordeaux-threads:make-thread #'(lambda () (with-object-lock-held (object :property 'another-slot)  (sleep 1) (push 'E result))))
    (bordeaux-threads:make-thread #'(lambda () (with-object-lock-held (object) (sleep 1) (push 'F result))))
    
    (sleep 2)
    (release-lock object 'a-slot)
    (sleep 8)
    
    result)

=> (F E C D B A) or (F E D C B A) depending on thread timming

Exported Symbols

License Information

This library is released under the MIT License. Please refer to the LICENSE to get the full licensing text.

Contributing to this project

Please refer to the CONTRIBUTING document for more information.


Next: , Previous: , Up: Top   [Contents][Index]

2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 trivial-object-lock

Author

Eric Diethelm <ediethelm@yahoo.com>

License

MIT

Description

A simple method to lock object (and slot) access.

Long Description
Version

0.3.2

Dependencies
Source

trivial-object-lock.asd (file)

Components

Next: , Previous: , Up: Top   [Contents][Index]

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.1 trivial-object-lock.asd

Location

trivial-object-lock.asd

Systems

trivial-object-lock (system)


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.2 trivial-object-lock/package.lisp

Parent

trivial-object-lock (system)

Location

package.lisp

Packages

trivial-object-lock


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.3 trivial-object-lock/trivial-object-lock.lisp

Parent

trivial-object-lock (system)

Location

trivial-object-lock.lisp

Exported Definitions
Internal Definitions

Previous: , Up: Lisp files   [Contents][Index]

3.1.4 trivial-object-lock/documentation.lisp

Parent

trivial-object-lock (system)

Location

documentation.lisp

Exported Definitions
Internal Definitions

update-readme (function)


Next: , Previous: , Up: Top   [Contents][Index]

4 Packages

Packages are listed by definition order.


Previous: , Up: Packages   [Contents][Index]

4.1 trivial-object-lock

trivial-object-lock provides a simple and probably naïve way to lock objects. Only real USP is its ability to lock object slots independently.

Source

package.lisp (file)

Use List
Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

5.1 Exported definitions


Next: , Previous: , Up: Exported definitions   [Contents][Index]

5.1.1 Special variables

Special Variable: @trivial-object-lock-contributing
Package

trivial-object-lock

Source

documentation.lisp (file)

Special Variable: @trivial-object-lock-description
Package

trivial-object-lock

Source

documentation.lisp (file)

Special Variable: @trivial-object-lock-example
Package

trivial-object-lock

Source

documentation.lisp (file)

Special Variable: @trivial-object-lock-exported
Package

trivial-object-lock

Source

documentation.lisp (file)

Special Variable: @trivial-object-lock-installing
Package

trivial-object-lock

Source

documentation.lisp (file)

Special Variable: @trivial-object-lock-license
Package

trivial-object-lock

Source

documentation.lisp (file)

Special Variable: @trivial-object-lock-manual
Package

trivial-object-lock

Source

documentation.lisp (file)


Next: , Previous: , Up: Exported definitions   [Contents][Index]

5.1.2 Macros

Macro: with-object-lock-held (OBJECT &key TEST PROPERTY TIMEOUT) &body BODY

Supporting macro to simplify usage of *ACQUIRE-LOCK* and *RELEASE-LOCK*.

Package

trivial-object-lock

Source

trivial-object-lock.lisp (file)


Next: , Previous: , Up: Exported definitions   [Contents][Index]

5.1.3 Functions

Function: acquire-lock OBJECT PROPERTY &key BLOCKING TIMEOUT TEST &aux OBJECT-LOCK COND-VAR THREAD

Acquire a lock on the given *OBJECT*. When not *NIL*, *PROPERTY* will be used to create a *PARTIAL-LOCK* on *OBJECT*; otherwise a *FULL-LOCK* is created.

Returns *NIL* if the lock was acquired; otherwise it returns a conditional variable to wait on.

Package

trivial-object-lock

Source

trivial-object-lock.lisp (file)

Function: release-lock OBJECT PROPERTY &key TEST &aux OBJECT-LOCK THREAD

Releases the lock held by the current thread on *OBJECT* and *PROPERTY*.

Relates to *ACQUIRE-LOCK*

Package

trivial-object-lock

Source

trivial-object-lock.lisp (file)


Previous: , Up: Exported definitions   [Contents][Index]

5.1.4 Conditions

Condition: interrupt-execution ()
Package

trivial-object-lock

Source

trivial-object-lock.lisp (file)

Direct superclasses

condition (condition)

Condition: lock-timeout ()
Package

trivial-object-lock

Source

trivial-object-lock.lisp (file)

Direct superclasses

condition (condition)


Previous: , Up: Definitions   [Contents][Index]

5.2 Internal definitions


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.1 Special variables

Special Variable: *function-lock*
Package

trivial-object-lock

Source

trivial-object-lock.lisp (file)

Special Variable: *lock-queue-counter*
Package

trivial-object-lock

Source

trivial-object-lock.lisp (file)

Special Variable: *locks-held*
Package

trivial-object-lock

Source

trivial-object-lock.lisp (file)


Previous: , Up: Internal definitions   [Contents][Index]

5.2.2 Functions

Function: find-next-waiting-lock OBJECT &aux NEXT PART
Package

trivial-object-lock

Source

trivial-object-lock.lisp (file)

Function: update-readme ()
Package

trivial-object-lock

Source

documentation.lisp (file)


Previous: , Up: Top   [Contents][Index]

Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts

Jump to:   F   L   T  
Index Entry  Section

F
File, Lisp, trivial-object-lock.asd: The trivial-object-lock<dot>asd file
File, Lisp, trivial-object-lock/documentation.lisp: The trivial-object-lock/documentation<dot>lisp file
File, Lisp, trivial-object-lock/package.lisp: The trivial-object-lock/package<dot>lisp file
File, Lisp, trivial-object-lock/trivial-object-lock.lisp: The trivial-object-lock/trivial-object-lock<dot>lisp file

L
Lisp File, trivial-object-lock.asd: The trivial-object-lock<dot>asd file
Lisp File, trivial-object-lock/documentation.lisp: The trivial-object-lock/documentation<dot>lisp file
Lisp File, trivial-object-lock/package.lisp: The trivial-object-lock/package<dot>lisp file
Lisp File, trivial-object-lock/trivial-object-lock.lisp: The trivial-object-lock/trivial-object-lock<dot>lisp file

T
trivial-object-lock.asd: The trivial-object-lock<dot>asd file
trivial-object-lock/documentation.lisp: The trivial-object-lock/documentation<dot>lisp file
trivial-object-lock/package.lisp: The trivial-object-lock/package<dot>lisp file
trivial-object-lock/trivial-object-lock.lisp: The trivial-object-lock/trivial-object-lock<dot>lisp file

Jump to:   F   L   T  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   A   F   M   R   U   W  
Index Entry  Section

A
acquire-lock: Exported functions

F
find-next-waiting-lock: Internal functions
Function, acquire-lock: Exported functions
Function, find-next-waiting-lock: Internal functions
Function, release-lock: Exported functions
Function, update-readme: Internal functions

M
Macro, with-object-lock-held: Exported macros

R
release-lock: Exported functions

U
update-readme: Internal functions

W
with-object-lock-held: Exported macros

Jump to:   A   F   M   R   U   W  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables

Jump to:   *   @  
S  
Index Entry  Section

*
*function-lock*: Internal special variables
*lock-queue-counter*: Internal special variables
*locks-held*: Internal special variables

@
@trivial-object-lock-contributing: Exported special variables
@trivial-object-lock-description: Exported special variables
@trivial-object-lock-example: Exported special variables
@trivial-object-lock-exported: Exported special variables
@trivial-object-lock-installing: Exported special variables
@trivial-object-lock-license: Exported special variables
@trivial-object-lock-manual: Exported special variables

S
Special Variable, *function-lock*: Internal special variables
Special Variable, *lock-queue-counter*: Internal special variables
Special Variable, *locks-held*: Internal special variables
Special Variable, @trivial-object-lock-contributing: Exported special variables
Special Variable, @trivial-object-lock-description: Exported special variables
Special Variable, @trivial-object-lock-example: Exported special variables
Special Variable, @trivial-object-lock-exported: Exported special variables
Special Variable, @trivial-object-lock-installing: Exported special variables
Special Variable, @trivial-object-lock-license: Exported special variables
Special Variable, @trivial-object-lock-manual: Exported special variables

Jump to:   *   @  
S  

Previous: , Up: Indexes   [Contents][Index]

A.4 Data types

Jump to:   C   I   L   P   S   T  
Index Entry  Section

C
Condition, interrupt-execution: Exported conditions
Condition, lock-timeout: Exported conditions

I
interrupt-execution: Exported conditions

L
lock-timeout: Exported conditions

P
Package, trivial-object-lock: The trivial-object-lock package

S
System, trivial-object-lock: The trivial-object-lock system

T
trivial-object-lock: The trivial-object-lock system
trivial-object-lock: The trivial-object-lock package

Jump to:   C   I   L   P   S   T