[comp.sys.mac.programmer] Enqueue'ing In a VBL

bob@eecs.nwu.edu (Bob Hablutzel) (10/15/88)

>I have a vertical blank routine which builds an event queue entry
>and Enqueue's is onto the queue.  Everything works exactly the way I
>want except sometimes when it is done just as I'm opening a folder or
>application, I get an address error.  In my routine, I'm also calling
>GetMouse(), TickCount(), NewPtr(), and sometimes Dequeue() and DisposPtr(),
>although I can't pin it down to those.  Again, it *only* happens right
>after a double click in the finder.  Got any ideas??

From your message, it sounds like you are calling GetMouse, TickCount, NewPtr,
and DisposPtr from within a VBL task. This is a bad thing. These routines
are all on the list of calls (from Inside Macintosh, Volume III, Page 211-213)
that can move or purge memory. However, VBL tasks are called at interrupt
level, and therefore when a VBL task executes, the memory manager is in
an uncertain state. Calling the memory manager, directly or indirectly, from
VBL tasks is certain to eventually crash your Mac.

Bob Hablutzel		BOB@NUACC.ACNS.NWU.EDU