freeze-type concurrency structures.

This commit is contained in:
Stas Boukarev 2020-03-20 14:44:13 +03:00
parent dd919e330e
commit 848a75af59
6 changed files with 10 additions and 0 deletions

View file

@ -67,6 +67,7 @@ Example:
;; an epoch marker to keep track of that.
(epoch (list t) :type cons)
(name nil))
(declaim (sb-ext:freeze-type frlock))
(setf (documentation 'frlock-name 'function)
"Name of an FRLOCK. SETFable.")

View file

@ -27,6 +27,7 @@ the state of a gate without blocking."
(queue (missing-arg) :type waitqueue)
(state :closed :type (member :open :closed))
(name nil :type (or null simple-string)))
(declaim (sb-ext:freeze-type gate))
(setf (documentation 'gatep 'function)
"Returns true if the argument is a GATE."

View file

@ -26,6 +26,7 @@ Messages can be arbitrary objects"
(queue (missing-arg) :type queue)
(semaphore (missing-arg) :type semaphore)
(name nil))
(declaim (sb-ext:freeze-type mailbox))
(setf (documentation 'mailboxp 'function)
"Returns true if argument is a MAILBOX, NIL otherwise."

View file

@ -41,6 +41,7 @@ Use ENQUEUE to add objects to the queue, and DEQUEUE to remove them."
(head (error "No HEAD.") :type cons)
(tail (error "No TAIL.") :type cons)
(name nil))
(declaim (sb-ext:freeze-type queue))
(setf (documentation 'queuep 'function)
"Returns true if argument is a QUEUE, NIL otherwise."

View file

@ -463,6 +463,7 @@ HOLDING-MUTEX-P."
%owner
%head
%tail)
(declaim (sb-ext:freeze-type waitqueue))
;;; Signals an error if owner of LOCK is waiting on a lock whose release
;;; depends on the current thread. Does not detect deadlocks from sempahores.
@ -1122,6 +1123,7 @@ future."
:type mutex)
(queue (make-waitqueue) :read-only t
:type waitqueue))
(declaim (sb-ext:freeze-type semaphore))
(setf (documentation 'semaphore-name 'function)
"The name of the semaphore INSTANCE. Setfable."
@ -1134,6 +1136,7 @@ future."
TRY-SEMAPHORE as the :NOTIFICATION argument. Consequences are undefined if
multiple threads are using the same notification object in parallel."
(%status nil :type boolean))
(declaim (sb-ext:freeze-type semaphore-notification))
(setf (documentation 'make-semaphore-notification 'function)
"Constructor for SEMAPHORE-NOTIFICATION objects. SEMAPHORE-NOTIFICATION-STATUS
@ -1283,6 +1286,7 @@ on this semaphore, then N of them is woken up."
(threads nil)
(interactive-threads nil)
(interactive-threads-queue (make-waitqueue)))
(declaim (sb-ext:freeze-type session))
(defvar *session* nil)

View file

@ -82,6 +82,8 @@ temporarily.")
"Asynchronous signal handling thread."
(signal-number nil :type integer))
(declaim (sb-ext:freeze-type mutex thread))
(defun mutex-value (mutex)
"Current owner of the mutex, NIL if the mutex is free. May return a
stale value, use MUTEX-OWNER instead."