Ignore:
Timestamp:
Jan 2, 2011, 2:12:48 AM (8 years ago)
Author:
gb
Message:

From wws: when using futexes in rwlock, limit the values in the
reader-signal/writer-signal slots to -1, 0.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/level-0/l0-misc.lisp

    r14540 r14541  
    890890               ;; That wasn't so bad, was it ?  We have the spinlock now.
    891891               (setf (%get-signed-natural ptr target::rwlock.state) 1)
     892               (setf (%get-signed-long write-signal) -1)
    892893               (%unlock-futex ptr)
    893894               (%set-object ptr target::rwlock.writer tcr)
     
    896897               t)
    897898           (incf (%get-natural ptr target::rwlock.blocked-writers))
    898            (let* ((waitval (%get-signed-long write-signal 0)))
     899           (let* ((waitval -1))
    899900             (%unlock-futex ptr)
    900901             (with-process-whostate ((rwlock-write-whostate lock))
     
    964965               (setf (%get-signed-natural ptr target::rwlock.state)
    965966                     (the fixnum (1- state)))
     967               (setf (%get-signed-long reader-signal) -1) ; can happen multiple times, but that's harmless
    966968               (%unlock-futex ptr)
    967969               (if flag
     
    970972           (declare (fixnum state))
    971973           (incf (%get-natural ptr target::rwlock.blocked-readers))
    972            (let* ((waitval (%get-signed-long reader-signal 0)))
     974           (let* ((waitval -1))
    973975             (%unlock-futex ptr)
    974976             (let* ((*interrupt-level* level))
     
    10671069             (if (> nreaders 0)
    10681070               (setq signal reader-signal wakeup #$INT_MAX)))))
    1069        (when signal (incf (%get-signed-long signal 0)))
     1071       (when signal (setf (%get-signed-long signal) 0))
    10701072       (%unlock-futex ptr)
    10711073       (when signal (futex-wake signal wakeup))
Note: See TracChangeset for help on using the changeset viewer.