0.pre8.6:
[sbcl.git] / src / code / sysmacs.lisp
index aba0098..558eac1 100644 (file)
 
 (in-package "SB!IMPL")
 \f
+
+#!-sb-thread
+(defmacro atomic-incf (symbol-name &optional (delta 1))
+  `(incf ,symbol-name ,delta))
+
+(defmacro atomic-decf (place &optional (delta 1))
+  `(atomic-incf ,place ,(- delta)))
+
+
 (defmacro without-gcing (&rest body)
   #!+sb-doc
   "Executes the forms in the body without doing a garbage collection."
   `(unwind-protect
-       (let ((*gc-inhibit* t))
-        ,@body)
-     (when (and *need-to-collect-garbage* (not *gc-inhibit*))
-       (maybe-gc nil))))
+    (progn
+      (atomic-incf *gc-inhibit*)
+      ,@body)
+    (atomic-decf *gc-inhibit*)
+    (when (and *need-to-collect-garbage* (zerop *gc-inhibit*))
+      (maybe-gc nil))))
+
 \f
 ;;; EOF-OR-LOSE is a useful macro that handles EOF.
 (defmacro eof-or-lose (stream eof-error-p eof-value)