Changeset 7721


Ignore:
Timestamp:
Nov 25, 2007, 2:25:31 AM (12 years ago)
Author:
gb
Message:

New lock stuff.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/working-0711/ccl/level-0/l0-aprims.lisp

    r7676 r7721  
    136136  "Create and return a lock object, which can be used for synchronization
    137137between threads."
    138   (gvector :lock (%make-recursive-lock-ptr) 'recursive-lock 0 name))
     138  (gvector :lock (%make-recursive-lock-ptr) 'recursive-lock 0 name nil nil))
    139139
    140140(defun lock-name (lock)
     
    147147    (report-bad-arg r 'recursive-lock)))
    148148
     149(defun recursive-lock-whostate (r)
     150  (if (and (eq target::subtag-lock (typecode r))
     151           (eq (%svref r target::lock.kind-cell) 'recursive-lock))
     152    (or (%svref r target::lock._value-cell)
     153        (setf (%svref r target::lock._value-cell)
     154              (format nil "Lock ~s wait" r)))
     155    (report-bad-arg r 'recursive-lock)))
     156
     157
    149158(defun read-write-lock-ptr (rw)
    150159  (if (and (eq target::subtag-lock (typecode rw))
     
    156165  "Create and return a read-write lock, which can be used for
    157166synchronization between threads."
    158   (gvector :lock (%make-rwlock-ptr) 'read-write-lock 0 nil))
    159 
     167  (gvector :lock (%make-rwlock-ptr) 'read-write-lock 0 nil nil nil))
     168
     169(defun rwlock-read-whostate (rw)
     170  (if (and (eq target::subtag-lock (typecode rw))
     171           (eq (%svref rw target::lock.kind-cell) 'read-write-lock))
     172    (or (%svref rw target::lock.whostate-cell)
     173        (setf (%svref rw target::lock.whostate-cell)
     174              (format nil "Read lock ~s wait" rw)))
     175    (report-bad-arg rw 'read-write-lock)))
     176
     177(defun rwlock-write-whostate (rw)
     178  (if (and (eq target::subtag-lock (typecode rw))
     179           (eq (%svref rw target::lock.kind-cell) 'read-write-lock))
     180    (or (%svref rw target::lock.whostate-2-cell)
     181        (setf (%svref rw target::lock.whostate-2-cell)
     182              (format nil "Read lock ~s wait" rw)))
     183    (report-bad-arg rw 'read-write-lock)))
     184 
    160185
    161186(defun %make-semaphore-ptr ()
Note: See TracChangeset for help on using the changeset viewer.