Skip to content

Commit 2985bc4

Browse files
committed
fixed bounded-queue full check (#86). added bounded-queue tests.
1 parent 72b042e commit 2985bc4

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

sento.asd

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
(defsystem "sento"
2-
:version "3.1.1"
2+
:version "3.3.0"
33
:author "Manfred Bergmann"
44
:license "Apache-2"
55
:description "Actor framework featuring actors and agents for easy access to state and asynchronous operations."
@@ -73,6 +73,7 @@
7373
(:file "config-test")
7474
(:file "wheel-timer-test")
7575
(:file "timeutils-test")
76+
(:file "bounded-queue-test")
7677
(:file "actor-cell-test")
7778
(:file "actor-mp-test")
7879
(:file "agent-test")

src/queue/queue.lisp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@
5656

5757
(defmethod pushq ((self queue-bounded) element)
5858
(with-slots (queue lock cvar fill-count max-items) self
59-
(when (>= fill-count max-items)
60-
(error 'queue-full-error :queue self))
6159
(bt2:with-lock-held (lock)
60+
(when (>= fill-count max-items)
61+
(error 'queue-full-error :queue self))
6262
(cl-speedy-queue:enqueue element queue)
6363
(incf fill-count)
6464
(bt2:condition-notify cvar))))

tests/actor-test.lisp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
(:shadow #:! #:?)
44
(:import-from #:miscutils
55
#:assert-cond
6-
#:await-cond)
6+
#:await-cond
7+
#:filter)
78
(:import-from #:timeutils
89
#:ask-timeout)
910
(:import-from #:ac
@@ -513,6 +514,6 @@
513514
(loop :repeat 10
514515
:collect (ignore-errors
515516
(tell actor "run")))))
516-
(is (= 1 (length (mapcan (lambda (x) (if x (list x))) tells))))
517-
(is (= 9 (length (mapcan (lambda (x) (if (null x) (list x))) tells)))))
517+
(is (= 1 (length (filter (lambda (x) (if x x)) tells))))
518+
(is (= 9 (length (filter #'null tells)))))
518519
(ac:shutdown sys))))

0 commit comments

Comments
 (0)