Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!hao!ames!ptsfa!well!ewhac From: ewhac@well.UUCP (Leo 'Bols Ewhac' Schwab) Newsgroups: comp.sys.amiga Subject: Re: Spawning tasks which draw . . . Message-ID: <4634@well.UUCP> Date: Sat, 5-Dec-87 05:32:53 EST Article-I.D.: well.4634 Posted: Sat Dec 5 05:32:53 1987 Date-Received: Thu, 10-Dec-87 06:16:01 EST References: <787@rocky.STANFORD.EDU> Reply-To: ewhac@well.UUCP (Leo 'Bols Ewhac' Schwab) Organization: Whole Earth 'Lectronic Link Lines: 57 In article <787@rocky.STANFORD.EDU> rokicki@rocky.STANFORD.EDU (Tomas Rokicki) writes: >/* > * bug.c > * > * Be careful with functions that use the blitter in tasks that you plan > * to RemTask() from the parent (or someone else!) If the blitter is > * allocated when the RemTask() is executed, it will stay allocated and > * the system will lock up tighter than a drum. To fix, simply Forbid()/ > * Permit() around all the blitter using sections (like a sequence of > * Move/Draws.) > * > * Compile and run this program (Manx). If you run it with the command: > * bug > * with no arguments, it locks up the machine. If you run it instead with > * bug forbid > * it will return correctly. The only difference between the two actions > * is the void subroutine it launches; one has the Forbid()/Permit() pair, > * the other doesn't, thus showing the problem. > */ Dale pointed this out to me when I asked if I could asynchronously longjmp() out of a graphics operation. Here are the things he enumerated: -------- Graphics may allocate tmp memory for some blit operations. In general we would like it to give it back. Graphics may own the blitter, we would want it to disown it also. Graphics calls LockLayer if the rastport has a layer attached to it. Actually it calls LockLayerRom which is a simple ObtainSemaphire [sic]. The Layerlibrary actually calls the graphics library to lock the layer so cosmic serenity is not disrupted. -------- It should also be noted that asynchronously RemTask()ing a running program is *NOT* kosher under any circumstances. Even if it's just a CPU-bound goodie that spins in place, it still isn't a good idea (in my opinion). The aforementioned Cosmic Serenity could be disrupted in ways we don't understand yet. That's why all sub-tasks that I write have some way of being terminated externally (via message or signal). Once I'm sure the task has completed, then I RemTask() it. I used to do a Wait(0L) to stop the task before RemTask()ing it, but the Manx CreateTask() function does things differently now, so I let the task exit, and it kills itself nicely (or something like that). God, I'm tired..... _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ Leo L. Schwab -- The Guy in The Cape ihnp4!ptsfa -\ \_ -_ Recumbent Bikes: dual ---> !{well,unicom}!ewhac O----^o The Only Way To Fly. hplabs / (pronounced "AE-wack") "Although there are technical differences between the quality of images created on the Amiga and on our system, we feel that viewers could be misled to believe otherwise, even with your disclaimers to the contrary." -- Ralph J. Guggenheim, Pixar "AMIGAS!!?? I thought we bought Pixars! Geez, I can't tell the difference." -- Max Headroom Producer