Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

luckless

1.0.0

Lockless 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:

  • caslist (MR|MW) a list or rather a stack-like object.

  • castable (MR|MW) a hash-table.

  • queue (SR|MW) a specialised event queue.

System Information

1.0.0
Nicolas Hafner
zlib

Definition Index

  • ORG.SHIRAKUMO.LUCKLESS.HASHTABLE

      No documentation provided.
      • EXTERNAL FUNCTION

        CLRHASH

          • TABLE
          Source
          Clears the hash table removing all entries.
        • EXTERNAL FUNCTION

          COUNT

            • TABLE
            Source
            Returns the current number of entries in the table.
            
            See SIZE
          • EXTERNAL FUNCTION

            GETHASH

              • KEY
              • TABLE
              • &OPTIONAL
              • DEFAULT
              Source
              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
                Source
                No documentation provided.
              • EXTERNAL FUNCTION

                MAKE-CASTABLE

                  • &KEY
                  • TEST
                  • SIZE
                  • HASH-FUNCTION
                  Source
                  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
                    Source
                    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
                      Source
                      Sets the entry IFF the entry does not exist yet.
                    • EXTERNAL FUNCTION

                      PUT-IF-EQUAL

                        • TABLE
                        • KEY
                        • NEW-VALUE
                        • OLD-VALUE
                        Source
                        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
                          Source
                          Sets the entry IFF the entry already exists.
                        • EXTERNAL FUNCTION

                          REMHASH

                            • KEY
                            • TABLE
                            Source
                            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
                              Source
                              Returns the current capacity of the table.
                              
                              See COUNT
                            • EXTERNAL FUNCTION

                              TEST

                                • TABLE
                                Source
                                Returns the equality test function.
                              • EXTERNAL FUNCTION

                                TRY-REMHASH

                                  • TABLE
                                  • KEY
                                  • VAL
                                  Source
                                  Removes the entry form the table IFF the value is still the specified one.
                                • EXTERNAL SOURCE-TRANSFORM

                                  CASTABLE-P

                                      No documentation provided.
                                  • ORG.SHIRAKUMO.LUCKLESS.QUEUE

                                      No documentation provided.
                                      • EXTERNAL STRUCTURE

                                        QUEUE

                                            Source
                                            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
                                              Source
                                              Discards all elements currently on the queue.
                                            • EXTERNAL FUNCTION

                                              LENGTH

                                                • QUEUE
                                                Source
                                                Returns the number of elements currently set in the queue.
                                              • EXTERNAL FUNCTION

                                                MAKE-QUEUE

                                                  • &OPTIONAL
                                                  • INITIAL-SIZE
                                                  Source
                                                  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
                                                    Source
                                                    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
                                                      Source
                                                      Pushes ELEMENT onto the queue.
                                                    • EXTERNAL FUNCTION

                                                      QUEUE-P

                                                        • OBJECT
                                                        Source
                                                        Returns T if the object is a QUEUE
                                                      • EXTERNAL SOURCE-TRANSFORM

                                                        QUEUE-P

                                                            No documentation provided.
                                                        • ORG.SHIRAKUMO.LUCKLESS.LIST

                                                            No documentation provided.
                                                            • EXTERNAL FUNCTION

                                                              DELETE

                                                                • VALUE
                                                                • LIST
                                                                Source
                                                                Removes the first occurrence of VALUE in the list.
                                                              • EXTERNAL FUNCTION

                                                                FIRST

                                                                  • LIST
                                                                  Source
                                                                  Returns the first element in the list, or NIL.
                                                                • EXTERNAL FUNCTION

                                                                  LENGTH

                                                                    • LIST
                                                                    Source
                                                                    Returns the number of elements in the list.
                                                                  • EXTERNAL FUNCTION

                                                                    MAPC

                                                                      • FUNCTION
                                                                      • LIST
                                                                      Source
                                                                      Calls FUNCTION with each element in the list.
                                                                      
                                                                      Returns the list.
                                                                    • EXTERNAL FUNCTION

                                                                      MEMBER

                                                                        • VALUE
                                                                        • LIST
                                                                        Source
                                                                        Returns T if the VALUE occurs at least once in the list.
                                                                      • EXTERNAL FUNCTION

                                                                        NTH

                                                                          • N
                                                                          • LIST
                                                                          Source
                                                                          Returns the N-th element in the list, or NIL.
                                                                        • EXTERNAL FUNCTION

                                                                          PUSH

                                                                            • VALUE
                                                                            • LIST
                                                                            Source
                                                                            Pushes a new element to the front of the list.
                                                                          • EXTERNAL FUNCTION

                                                                            TO-LIST

                                                                              • LIST
                                                                              Source
                                                                              Turns the CASLIST in to a standard chain of CONSes.
                                                                            • EXTERNAL SOURCE-TRANSFORM

                                                                              CASLIST-P

                                                                                  No documentation provided.