4.1.1 Defining and calling foreign functions

4.1.1.1 Avoiding SIGALRM signals

Some foreign code might have to prepare for receivingsigalrm signals, as an open system call can exit when it receives such a signal. Use the following macro to preventsigalrm signals from being delivered during a foreign call that calls such a system call function.

(defmacro with-sigalrm-blocked (&body body)
  (let ((old-signal (gensym)))
    '(let ((,old-signal nil))
       (unwind-protect
           (progn
             (setq ,old-signal (system:block-more-signals #x2000))
             ,@body)
         (when ,old-signal 
               (system:set-signal-mask ,old-signal))))))


The Advanced User's Guide - 9 SEP 1996

Generated with Harlequin WebMaker