luckless
1.0.0Lockless data structures
About Luckless
Luckless is a collection of lock-free data structures. Meaning: these structures only rely on CAS for their operation, which often ends up more efficient than equivalent methods using locks.
Each data structure in Luckless is implemented in its own package, which exports symbols similar to existing Common Lisp symbols of similar structures. You are meant to create a package-local nickname of the structures' package and use them that way.
Implemented Structures
The following data structures are currently implemented by the library:
System Information
Definition Index
-
ORG.SHIRAKUMO.LUCKLESS.HASHTABLE
No documentation provided.-
EXTERNAL STRUCTURE CASTABLE
A lock-free hash-table. It is safe to set entries from any number of threads simultaneously. Note that the hash table will never shrink, even if it is cleared or entries are removed from it. If you need to shrink the table, discard it and create a new one instead. See MAKE-CASTABLE See CASTABLE-P See SIZE See COUNT See TEST See HASH-FUNCTION See GETHASH See REMHASH See TRY-REMHASH See PUT-IF-ABSENT See PUT-IF-EQUAL See PUT-IF-PRESENT See CLRHASH See MAPHASH
-
EXTERNAL FUNCTION CASTABLE-P
- OBJECT
Returns true if the object is a CASTABLE See CASTABLE (type)
-
EXTERNAL FUNCTION CLRHASH
- TABLE
Clears the hash table removing all entries.
-
EXTERNAL FUNCTION COUNT
- TABLE
Returns the current number of entries in the table. See SIZE
-
EXTERNAL FUNCTION GETHASH
- KEY
- TABLE
- &OPTIONAL
- DEFAULT
Accesses an entry in the hash table. If no entry was present, DEFAULT is returned. IF-EXISTS can be one of the following: :OVERWRITE --- Replace the entry's value :ERROR --- Signal an error NIL --- Do nothing IF-DOES-NOT-EXIST can be one of the following: :OVERWRITE --- Set the entry's value :ERROR --- Signal an error NIL --- Do nothing This is safe to call from any number of threads.
-
EXTERNAL FUNCTION (SETF GETHASH)
- VALUE
- KEY
- TABLE
- &OPTIONAL
- DEFAULT
- &KEY
- IF-EXISTS
- IF-DOES-NOT-EXIST
No documentation provided. -
EXTERNAL FUNCTION HASH-FUNCTION
- TABLE
Returns the hashing function used.
-
EXTERNAL FUNCTION MAKE-CASTABLE
- &KEY
- TEST
- SIZE
- HASH-FUNCTION
Create a new castable. TEST should be one of EQ EQL EQUAL EQUALP SIZE should be a base size to start the table with. May be modified by the implementation. HASH-FUNCTION should be a function of one argument that returns a integer used as a hash for the argument. Unless explicitly passed, will determine the hash function to use based on TEST. See CASTABLE (type)
-
EXTERNAL FUNCTION MAPHASH
- FUNCTION
- TABLE
Maps over the hash table. FUNCTION must accept two arguments, the KEY and the VALUE of the entry currently being mapped.
-
EXTERNAL FUNCTION PUT-IF-ABSENT
- TABLE
- KEY
- VALUE
Sets the entry IFF the entry does not exist yet.
-
EXTERNAL FUNCTION PUT-IF-EQUAL
- TABLE
- KEY
- NEW-VALUE
- OLD-VALUE
Sets the entry IFF the entry already exists and its current value is the specified old-value.
-
EXTERNAL FUNCTION PUT-IF-PRESENT
- TABLE
- KEY
- VALUE
Sets the entry IFF the entry already exists.
-
EXTERNAL FUNCTION REMHASH
- KEY
- TABLE
Removes an entry from the hash table. Returns T if there was an entry in the table. This is safe to call from any number of threads.
-
EXTERNAL FUNCTION SIZE
- TABLE
Returns the current capacity of the table. See COUNT
-
EXTERNAL FUNCTION TEST
- TABLE
Returns the equality test function.
-
EXTERNAL FUNCTION TRY-REMHASH
- TABLE
- KEY
- VAL
Removes the entry form the table IFF the value is still the specified one.
-
EXTERNAL SOURCE-TRANSFORM CASTABLE-P
No documentation provided. -
EXTERNAL SOURCE-TRANSFORM (SETF CASTABLE-P)
No documentation provided.
-
-
ORG.SHIRAKUMO.LUCKLESS.QUEUE
No documentation provided.-
EXTERNAL STRUCTURE QUEUE
A lock-free multiple-writer single-reader queue. This queue is optimised to allow many writer threads at once and a single, but efficient-to-iterate reader thread. The queue can resize to fit more elements, but remains O(1) for PUSH. See MAKE-QUEUE See QUEUE-P See PUSH See DISCARD See MAPC See LENGTH
-
EXTERNAL FUNCTION DISCARD
- QUEUE
Discards all elements currently on the queue.
-
EXTERNAL FUNCTION LENGTH
- QUEUE
Returns the number of elements currently set in the queue.
-
EXTERNAL FUNCTION MAKE-QUEUE
- &OPTIONAL
- INITIAL-SIZE
Returns a new QUEUE. The INITIAL-SIZE is a hint as to the capacity of the queue before it needs to resize. See QUEUE (type)
-
EXTERNAL FUNCTION MAPC
- FUNCTION
- QUEUE
Maps FUNCTION over all elements in the queue. Note that this will also consume all elements, leaving the queue empty after iteration.
-
EXTERNAL FUNCTION PUSH
- ELEMENT
- QUEUE
Pushes ELEMENT onto the queue.
-
EXTERNAL FUNCTION QUEUE-P
- OBJECT
Returns T if the object is a QUEUE
-
EXTERNAL SOURCE-TRANSFORM QUEUE-P
No documentation provided. -
EXTERNAL SOURCE-TRANSFORM (SETF QUEUE-P)
No documentation provided.
-
-
ORG.SHIRAKUMO.LUCKLESS.LIST
No documentation provided.-
EXTERNAL STRUCTURE CASLIST
-
EXTERNAL FUNCTION CASLIST
- &REST
- VALUES
Returns a new CASLIST containing ELEMENTS. See CASLIST (type)
-
EXTERNAL FUNCTION CASLIST-P
- OBJECT
Returns T if the object is a CASLIST See CASLIST (type)
-
EXTERNAL FUNCTION DELETE
- VALUE
- LIST
Removes the first occurrence of VALUE in the list.
-
EXTERNAL FUNCTION FIRST
- LIST
Returns the first element in the list, or NIL.
-
EXTERNAL FUNCTION LENGTH
- LIST
Returns the number of elements in the list.
-
EXTERNAL FUNCTION MAPC
- FUNCTION
- LIST
Calls FUNCTION with each element in the list. Returns the list.
-
EXTERNAL FUNCTION MEMBER
- VALUE
- LIST
Returns T if the VALUE occurs at least once in the list.
-
EXTERNAL FUNCTION NTH
- N
- LIST
Returns the N-th element in the list, or NIL.
-
EXTERNAL FUNCTION PUSH
- VALUE
- LIST
Pushes a new element to the front of the list.
-
EXTERNAL FUNCTION TO-LIST
- LIST
Turns the CASLIST in to a standard chain of CONSes.
-
EXTERNAL SOURCE-TRANSFORM CASLIST-P
No documentation provided. -
EXTERNAL SOURCE-TRANSFORM (SETF CASLIST-P)
No documentation provided.
-