[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]



re: disposing of pointers
You bet there's a window of vulnerability!  Strictly speaking, you really need
an UNWIND-PROTECT around this thing.  How about this (untested) macro:

(defmacro with-temp-bitmap ((var . limits) &body body)
   `(let ((,var (make-bitmap ., limits)))
      (unwind-protect
	(progn ., body)
	(when ,var
	  (dispose-record (prog1 ,var (setq ,var nil)))))))

At least you should use something that acts like the last form in this macro,
even if you don't go through the trouble of protecting agaist losing free
storage.  The important thing is that you get rid of the pointer before
flushing the data it points to.

In general, you should be very careful disposing of anything in Lisp.  While
with Mac'isms in force, it's unlikely to happen; it's still really much better
to write code with the assumption that interrupts are possible, and that you
might someday be running in a multiple process (or even multiple-processor)
environment.

				-- Tovar
 
P.S.  My apologies to old LispM hackers out there who have seen this sort of 
thing hundreds of times.  This msg. is for those who just got on the bus now
that there are Lisps accessible to ordinary folks.

P.P.S.  Does anyone have some sample code they could send me (perhaps a .sit
file, so as to include any needed binaries) which will open a simple IP/TCP
connection from inside MACL?  (I've not had good luck with the things in the
archives i know about.)  FF code is fine if need be.