From 4150a9f9936714c8a04fc2cd8ae6df26ec5f7db8 Mon Sep 17 00:00:00 2001 From: Nikodemus Siivola Date: Thu, 7 Feb 2013 19:45:18 -0500 Subject: [PATCH] update LIST-QUEUE-CONTENTS docstring, add note --- NEWS | 2 ++ contrib/sb-concurrency/queue.lisp | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 8985a10..e717e47 100644 --- a/NEWS +++ b/NEWS @@ -27,6 +27,8 @@ changes relative to sbcl-1.1.4: * enhancement: test-suite results are colorized, failures in red, unexpected success in green. Works on Windows and on terminals with ANSI escape code support. Can be disabled with --no-color. + * optimization: SB-CONCURRENCY:QUEUE implementation is more efficient. + (thanks to James M. Lawrence) * bug fix: no more unused variable style warnings from RESTART-CASE macroexpansion (lp#1113859) * bug fix: no more unused variable style warnings when loading diff --git a/contrib/sb-concurrency/queue.lisp b/contrib/sb-concurrency/queue.lisp index 397e29e..9b0949e 100644 --- a/contrib/sb-concurrency/queue.lisp +++ b/contrib/sb-concurrency/queue.lisp @@ -92,6 +92,8 @@ and secondary value." (return (values value t))))))))) (defun try-walk-queue (fun queue) + ;; This isn't /quite/ as bad as it looks. We're in danger of needing + ;; to restart only as long as we're close to the head of the queue. (let ((node (queue-head queue))) (loop (let ((value (car node))) @@ -105,8 +107,9 @@ and secondary value." (defun list-queue-contents (queue) "Returns the contents of QUEUE as a list without removing them from the -QUEUE. Mainly useful for manual examination of queue state, as the list -may be out of date by the time it is returned." +QUEUE. Mainly useful for manual examination of queue state, as the list may be +out of date by the time it is returned, and concurrent dequeue operations may +in the worse case force the queue-traversal to be restarted several times." (tagbody :retry (collect ((result)) -- 1.7.10.4