Changeset 463


Ignore:
Timestamp:
Feb 2, 2004, 8:11:09 AM (21 years ago)
Author:
Gary Byers
Message:

Handshaking during QUIT/PREPARE-TO-QUIT; this is intended to work around
a bug where #_pthread_kill seems to not deliver the signal to the target
thread if the signaling thread (a) exits and (b) runs certain Cocoa
tsd-cleanup routines. (I.e., it's a mystery.)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/level-1/l1-readloop.lisp

    r361 r463  
    155155        (if res (return-from find-restart-2 restart)(setq res restart))))))
    156156|#
     157
     158(defglobal *quit-acknowledge* nil)
     159(defglobal *quit-acknowledge-lock* (make-lock))
     160
    157161(defun quit (&optional (exit-status 0))
    158162  (let* ((ip *initial-process*)
     
    165169                                       (#_exit exit-status)))))
    166170      (unless (eq cp ip)
     171        (when (try-lock *quit-acknowledge-lock*)
     172          (let-globally ((*quit-acknowledge* (make-semaphore)))
     173                        (timed-wait-on-semaphore *quit-acknowledge* 1)))
    167174        (process-kill cp)))))
    168175
     
    176183
    177184(defun prepare-to-quit (&optional part)
     185  (when *quit-acknowledge* (signal-semaphore *quit-acknowledge*))
    178186  (let-globally ((*quitting* t))
    179                
    180187    (when (or (null part) (eql 0 part))
    181188      (dolist (f *lisp-cleanup-functions*)
Note: See TracChangeset for help on using the changeset viewer.