Changeset 7687 for branches/working-0710


Ignore:
Timestamp:
Nov 20, 2007, 3:01:28 PM (12 years ago)
Author:
gb
Message:

MAKE-LIST moved here.

WHOSTATE fields in LOCKs.

File:
1 edited

Legend:

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

    r7390 r7687  
    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 ()
     
    180205(setf (type-predicate 'semaphore) 'semaphorep)
    181206
     207(defun make-list (size &key initial-element)
     208  "Constructs a list with size elements each set to value"
     209  (unless (and (typep size 'fixnum)
     210               (>= (the fixnum size) 0))
     211    (report-bad-arg size '(and fixnum unsigned-byte)))
     212  (locally (declare (fixnum size))
     213    (do* ((result '() (cons initial-element result)))
     214        ((zerop size) result)
     215      (decf size))))
     216
    182217; end
Note: See TracChangeset for help on using the changeset viewer.