-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
documentation.lisp
201 lines (146 loc) · 4.89 KB
/
documentation.lisp
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
;;; hashtable.lisp
(in-package #:org.shirakumo.luckless.hashtable)
(docs:define-docs
(function make-castable
"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)")
(type 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")
(function castable-p
"Returns true if the object is a CASTABLE
See CASTABLE (type)")
(function size
"Returns the current capacity of the table.
See COUNT")
(function count
"Returns the current number of entries in the table.
See SIZE")
(function test
"Returns the equality test function.")
(function hash-function
"Returns the hashing function used.")
(function gethash
"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.")
(function remhash
"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.")
(function try-remhash
"Removes the entry form the table IFF the value is still the specified one.")
(function put-if-absent
"Sets the entry IFF the entry does not exist yet.")
(function put-if-equal
"Sets the entry IFF the entry already exists and its current value is the specified old-value.")
(function put-if-present
"Sets the entry IFF the entry already exists.")
(function clrhash
"Clears the hash table removing all entries.")
(function maphash
"Maps over the hash table.
FUNCTION must accept two arguments, the KEY and the VALUE of the entry
currently being mapped."))
;;; list.lisp
(in-package #:org.shirakumo.luckless.list)
(docs:define-docs
(type caslist
"A lock-free linked list.
It is safe to add and remove entries from any number of threads
simultaneously.
See CASLIST (function)
See CASLIST-P
See TO-LIST
See MAPC
See FIRST
See NTH
See LENGTH
See PUSH
See DELETE
See MEMBER")
(function caslist
"Returns a new CASLIST containing ELEMENTS.
See CASLIST (type)")
(function caslist-p
"Returns T if the object is a CASLIST
See CASLIST (type)")
(function to-list
"Turns the CASLIST in to a standard chain of CONSes.")
(function mapc
"Calls FUNCTION with each element in the list.
Returns the list.")
(function first
"Returns the first element in the list, or NIL.")
(function nth
"Returns the N-th element in the list, or NIL.")
(function length
"Returns the number of elements in the list.")
(function push
"Pushes a new element to the front of the list.")
(function delete
"Removes the first occurrence of VALUE in the list.")
(function member
"Returns T if the VALUE occurs at least once in the list."))
;;; queue.lisp
(in-package #:org.shirakumo.luckless.queue)
(docs:define-docs
(type 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")
(function make-queue
"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)")
(function queue-p
"Returns T if the object is a QUEUE")
(function push
"Pushes ELEMENT onto the queue.")
(function discard
"Discards all elements currently on the queue.")
(function mapc
"Maps FUNCTION over all elements in the queue.
Note that this will also consume all elements, leaving the queue empty
after iteration.")
(function length
"Returns the number of elements currently set in the queue."))