Completed cleanup invariant

master
Brady McDonough 2 years ago
parent 63d04ebadb
commit 483a088a77

@ -155,6 +155,8 @@
(define-error 'tacc-error "Generic error from the tacc-timer module" 'error)
(define-error 'tacc-error-illegal-buffer-state
"Precondition failed, the timer buffer is in an invalid state" 'tacc-error)
(define-error 'tacc-dirty-state
"Precondition failed, tacc state wasn't clean" 'tacc-error)
(define-error 'tacc-error-serialization-registered
"Failed to register a serialization, serializations must have unique names"
'tacc-error)
@ -332,22 +334,22 @@ Note, if there is no tacc-buffer then you shouldn't be touching tacc-info"
(if (tacc-live-state?)
t
;; Timer running without reason in logic
(signal 'tacc-error-illegal-buffer-state (tacc-buffer)))
(signal 'tacc-error-illegal-buffer-state tacc-timer))
(if (tacc-session-state?)
t
;; Buffer is live without reason in logic
(signal 'tacc-error-illegal-buffer-state (tacc-buffer))))
;; We shouldn't be calling this when the buffer is dead
(signal 'tacc-error-illegal-buffer-state (tacc-buffer))))
(signal 'tacc-error-illegal-buffer-state "No buffer")))
(defun tacc-cleanup-invariant ()
"Returns t if tacc is in a cleaned up state, signals an error otherwise"
(if (bufferp (tacc-buffer))
(signal 'tacc-dirty-state (tacc-buffer))
(signal 'tacc-error-dirty-state (tacc-buffer))
(if (tacc-live?)
(signal 'tacc-dirty-state tacc-timer)
(signal 'tacc-error-dirty-state tacc-timer)
(if (tacc-session?)
(signal 'tacc-dirty-state tacc-info)
(signal 'tacc-error-dirty-state tacc-info)
t))))
;; 05.3 Predicates and helpers

Loading…
Cancel
Save