Changeset 7744


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

%TRY-RECURSIVE-LOCK-OBJECT: fix #-futex case.

File:
1 edited

Legend:

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

    r7723 r7744  
    638638#-futex
    639639(defun %try-recursive-lock-object (lock &optional flag)
    640   (with-macptrs ((p)
    641                  (owner (%get-ptr ptr target::lockptr.owner))
    642                  (spin (%inc-ptr ptr target::lockptr.spinlock)))
    643     (%setf-macptr-to-object p (%current-tcr))
    644     (if flag
    645       (if (istruct-typep flag 'lock-acquisition)
    646         (setf (lock-acquisition.status flag) nil)
    647         (report-bad-arg flag 'lock-acquisition)))
    648     (without-interrupts
    649      (cond ((eql p owner)
    650             (incf (%get-natural ptr target::lockptr.count))
    651             (setq *locks-held* (%lock-cons lock *locks-held*))
    652             (if flag (setf (lock-acquisition.status flag) t))
    653             t)
    654            (t
    655             (let* ((win nil))
    656               (%get-spin-lock spin)
    657               (when (setq win (eql 1 (incf (%get-natural ptr target::lockptr.avail))))
    658                 (setf (%get-ptr ptr target::lockptr.owner) p
    659                       (%get-natural ptr target::lockptr.count) 1)
    660                 (setq *locks-held* (%lock-cons lock *locks-held*))
    661                 (if flag (setf (lock-acquisition.status flag) t)))
    662               (setf (%get-ptr spin) (%null-ptr))
    663               win))))))
     640  (let* ((ptr (recursive-lock-ptr lock)))
     641    (with-macptrs ((p)
     642                   (owner (%get-ptr ptr target::lockptr.owner))
     643                   (spin (%inc-ptr ptr target::lockptr.spinlock)))
     644      (%setf-macptr-to-object p (%current-tcr))
     645      (if flag
     646        (if (istruct-typep flag 'lock-acquisition)
     647          (setf (lock-acquisition.status flag) nil)
     648          (report-bad-arg flag 'lock-acquisition)))
     649      (without-interrupts
     650       (cond ((eql p owner)
     651              (incf (%get-natural ptr target::lockptr.count))
     652              (setq *locks-held* (%lock-cons lock *locks-held*))
     653              (if flag (setf (lock-acquisition.status flag) t))
     654              t)
     655             (t
     656              (let* ((win nil))
     657                (%get-spin-lock spin)
     658                (when (setq win (eql 1 (incf (%get-natural ptr target::lockptr.avail))))
     659                  (setf (%get-ptr ptr target::lockptr.owner) p
     660                        (%get-natural ptr target::lockptr.count) 1)
     661                  (setq *locks-held* (%lock-cons lock *locks-held*))
     662                  (if flag (setf (lock-acquisition.status flag) t)))
     663                (setf (%get-ptr spin) (%null-ptr))
     664                win)))))))
    664665
    665666
Note: See TracChangeset for help on using the changeset viewer.