From: Nikodemus Siivola Date: Thu, 1 Dec 2011 09:16:09 +0000 (+0200) Subject: fix bug in semaphore notification objects on TRY-SEMAPHORE X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=c6fecd1dcff10bce2e88f67bfade3aab3f7309ac;p=sbcl.git fix bug in semaphore notification objects on TRY-SEMAPHORE It's not notifiction. --- diff --git a/src/code/target-thread.lisp b/src/code/target-thread.lisp index 948032b..7ec3309 100644 --- a/src/code/target-thread.lisp +++ b/src/code/target-thread.lisp @@ -1023,7 +1023,7 @@ the status is set to T." (when (not (minusp new-count)) (setf (semaphore-%count semaphore) new-count) (when notification - (setf (semaphore-notifiction-%status notification) t)) + (setf (semaphore-notification-%status notification) t)) ;; FIXME: We don't actually document this -- should we just ;; return T, or document new count as the return? new-count)))) diff --git a/tests/threads.pure.lisp b/tests/threads.pure.lisp index 1545237..adcf13a 100644 --- a/tests/threads.pure.lisp +++ b/tests/threads.pure.lisp @@ -496,7 +496,7 @@ :timeout 0.01 :default cookie))))) -(with-test (:name :semaphore-notification +(with-test (:name (:semaphore-notification :wait-on-semaphore) :skipped-on '(not :sb-thread)) (let ((sem (make-semaphore)) (ok nil) @@ -542,3 +542,13 @@ unsafe))) (assert (= n (+ k (length safe)))) (assert unsafe)))))) + +(with-test (:name (:semaphore-notification :try-sempahore) + :skipped-on '(not :sb-thread)) + (let* ((sem (make-semaphore)) + (note (make-semaphore-notification))) + (try-semaphore sem 1 note) + (assert (not (semaphore-notification-status note))) + (signal-semaphore sem) + (try-semaphore sem 1 note) + (assert (semaphore-notification-status note))))