/[slime]/slime/swank-backend.lisp
ViewVC logotype

Diff of /slime/swank-backend.lisp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.137 by heller, Tue Aug 5 17:38:39 2008 UTC revision 1.138 by heller, Tue Aug 5 17:38:44 2008 UTC
# Line 969  user. They do not have to be unique." Line 969  user. They do not have to be unique."
969    
970  (definterface make-lock (&key name)  (definterface make-lock (&key name)
971     "Make a lock for thread synchronization.     "Make a lock for thread synchronization.
972  Only one thread may hold the lock (via CALL-WITH-LOCK-HELD) at a time."  Only one thread may hold the lock (via CALL-WITH-LOCK-HELD) at a time
973    but that thread may hold it more than once."
974     (declare (ignore name))     (declare (ignore name))
975     :null-lock)     :null-lock)
976    
# Line 979  Only one thread may hold the lock (via C Line 980  Only one thread may hold the lock (via C
980              (type function function))              (type function function))
981     (funcall function))     (funcall function))
982    
 (definterface make-recursive-lock (&key name)  
   "Make a lock for thread synchronization.  
 Only one thread may hold the lock (via CALL-WITH-RECURSIVE-LOCK-HELD)  
 at a time, but that thread may hold it more than once."  
   (cons nil (make-lock :name name)))  
   
 (definterface call-with-recursive-lock-held (lock function)  
   "Call FUNCTION with LOCK held, queueing if necessary."  
   (if (eql (car lock) (current-thread))  
       (funcall function)  
       (call-with-lock-held (cdr lock)  
                            (lambda ()  
                              (unwind-protect  
                                   (progn  
                                     (setf (car lock) (current-thread))  
                                     (funcall function))  
                                (setf (car lock) nil))))))  
   
983  (definterface current-thread ()  (definterface current-thread ()
984    "Return the currently executing thread."    "Return the currently executing thread."
985    0)    0)

Legend:
Removed from v.1.137  
changed lines
  Added in v.1.138

  ViewVC Help
Powered by ViewVC 1.1.5