1.0.6.36: ALLOW-WITH-INTERRUPTS and interrupt safe WITH-MUTEX &co
commitc548f73e8dd676d6ec4576eba6ab661a5061bdfe
authorNikodemus Siivola <nikodemus@random-state.net>
Fri, 8 Jun 2007 12:15:44 +0000 (8 12:15 +0000)
committerNikodemus Siivola <nikodemus@random-state.net>
Fri, 8 Jun 2007 12:15:44 +0000 (8 12:15 +0000)
tree06ea40624a295f14963d957a6210e68e0e496499
parenta3f37bab2cbaf80db811d480d5b2b95850def3b9
1.0.6.36: ALLOW-WITH-INTERRUPTS and interrupt safe WITH-MUTEX &co

 * Remove the *IN-INTERRUPTION* kludge, and replace it with a
   general-purpose mechanism.

 * New variable: *ALLOW-WITH-INTERRRUPTS*. WITH-INTERRUPTS is a no-op
   unless it is true and interrupts are inhibited.

 * WITHOUT-INTERRUPTS binds *ALLOW-WITH-INTERRUPTS* to NIL, and
   establishes ALLOW-WITH-INTERRUPTS and WITH-LOCAL-INTERRUPTS as
   local macros.

   ALLOW-WITH-INTERRUPTS binds *ALLOW-WITH-INTERRUPTS* to the value it
   held before entry to WITHOUT-INTERRUPTS.

   WITH-LOCAL-INTERRUPTS is equivalent to
     (allow-with-interrups (with-interrupts ...))
   but somewhat more efficient.

 * Use the above to make WITH-MUTEX &co interrupt-safe, but still
   interruptible: WITH-FOO becomes
     (without-interrupts
       (unwind-protect
           (when (setf foo (allow-with-interrupts (get-foo)))
             (with-local-interrupts ...))
         (when foo
           (release-foo foo))))
   and GET-FOO wraps it's waiting section inside a WITH-INTERRUPTS.

 * While at it, rewrite WITH-MUTEX &co to use CALL-WITH-FOO style
   expansions.

 * Write CALL-WITH-SYSTEM-MUTEX as a more efficient alternative to:

     (without-interrupt (with-mutex ...)) ; and
     (without-gcing (with-mutex ...))

   Similarly for CALL-WITH-RECURSIVE-SYSTEM-SPINLOCK, for the benefit
   of PCL.

 * No need to signal a WARNING for WITH-INTERRUPTS inside a WITHOUT-GCING,
   as *ALLOW-WITH-INTERRUPTS* is always false there, so interrupts will
   not be enabled.
22 files changed:
NEWS
package-data-list.lisp-expr
src/code/cold-init.lisp
src/code/cross-misc.lisp
src/code/deadline.lisp
src/code/early-impl.lisp
src/code/fd-stream.lisp
src/code/final.lisp
src/code/run-program.lisp
src/code/signal.lisp
src/code/sysmacs.lisp
src/code/target-signal.lisp
src/code/target-thread.lisp
src/code/thread.lisp
src/code/timer.lisp
src/code/toplevel.lisp
src/compiler/generic/parms.lisp
src/pcl/cache.lisp
src/pcl/dfun.lisp
src/runtime/thread.c
tests/threads.impure.lisp
version.lisp-expr