Index: /trunk/source/level-0/l0-misc.lisp
===================================================================
--- /trunk/source/level-0/l0-misc.lisp	(revision 14540)
+++ /trunk/source/level-0/l0-misc.lisp	(revision 14541)
@@ -890,4 +890,5 @@
                ;; That wasn't so bad, was it ?  We have the spinlock now.
                (setf (%get-signed-natural ptr target::rwlock.state) 1)
+               (setf (%get-signed-long write-signal) -1)
                (%unlock-futex ptr)
                (%set-object ptr target::rwlock.writer tcr)
@@ -896,5 +897,5 @@
                t)
            (incf (%get-natural ptr target::rwlock.blocked-writers))
-           (let* ((waitval (%get-signed-long write-signal 0)))
+           (let* ((waitval -1))
              (%unlock-futex ptr)
              (with-process-whostate ((rwlock-write-whostate lock))
@@ -964,4 +965,5 @@
                (setf (%get-signed-natural ptr target::rwlock.state)
                      (the fixnum (1- state)))
+               (setf (%get-signed-long reader-signal) -1) ; can happen multiple times, but that's harmless
                (%unlock-futex ptr)
                (if flag
@@ -970,5 +972,5 @@
            (declare (fixnum state))
            (incf (%get-natural ptr target::rwlock.blocked-readers))
-           (let* ((waitval (%get-signed-long reader-signal 0)))
+           (let* ((waitval -1))
              (%unlock-futex ptr)
              (let* ((*interrupt-level* level))
@@ -1067,5 +1069,5 @@
              (if (> nreaders 0)
                (setq signal reader-signal wakeup #$INT_MAX)))))
-       (when signal (incf (%get-signed-long signal 0)))
+       (when signal (setf (%get-signed-long signal) 0))
        (%unlock-futex ptr)
        (when signal (futex-wake signal wakeup))
