Path: utzoo!utgpu!utfyzx!oscvax!rico From: rico@oscvax.UUCP (Rico Mariani) Newsgroups: comp.sys.amiga Subject: Re: New PopCLI Message-ID: <545@oscvax.UUCP> Date: Wed, 9-Dec-87 10:55:32 EST References: <799@rocky.STANFORD.EDU> <4646@well.UUCP> Reply-To: rico@oscvax.UUCP (Rico Mariani) Organization: Ontario Science Centre, Toronto Lines: 57 Summary: ewhac@well.UUCP (Leo 'Bols Ewhac' Schwab) writes: >rokicki@rocky.STANFORD.EDU (Tomas Rokicki) writes: >>Don't use the PopCLI I posted; if you stick in a disk when it is drawing its >>pretty patterns, the machine will lock up. Must be something to do with my >>Forbid(); Draw(); Permit(); so don't use that either until I figure out >>what's going on. (I just found this bug a few seconds ago and will debug it >>when time permits.) [ ... ] > > Consider the internal implementation of Draw(): > > OwnBlitter (); > for (i=0; i < NUMBER_OF_PLANES; i++) { > WaitBlit (); /* <--- This is the important bit */ > FillBiltterRegisters (); > StartBlitter (); > } > DisownBlitter (); > > Now, imagine a Forbid()/Permit() pair around this. When you call >WaitBlit(), you may block. If you block, you temporarily give up your right >to Forbid() the system. It is at this point that your drawing subtask >(which I strongly suspect is similar to the one you posted recently) may get >RemTask()ed out from under its feet. > > Great. The task now owns the blitter. The task also no longer >exists. Can you say "system locked up tighter than a drum"? I knew you >could. > > I said it before; I'll say it again: It is *NEVER* kosher (from an >academic standpoint, admittedly) to arbitrarily RemTask() a running task. >*ALL TASKS MUST RUN TO COMPLETION TO PRESERVE COSMIC SERENITY.* Why would anyone ever want to RemTask() a running task? Am I missing something here? If you want your program to stop then you send it a message/signal requesting it to do so and arrange for it to be waiting for such a message/signal (hopefully blocked on it when idle). If you don't know enough about the program to know what signal etc. it's waiting on then you're just asking for trouble RemTask()ing it. When designing this kind of stuff you have to remember that Amiga system calls are not atomic, in fact most IO related (graphics/keyboard/dos/etc) calls can block your task for a while so count on this. It doesn't matter whether you're Draw()ing, Move()ing, BltBitMapRastPort()ing or whatever, RemTask() is just plain the wrong thing to do to stop a program. Then again... I could be mistaken :-) -Rico Can't wait to see the new PopCLI... PopCLI gets my vote for the all time handiest and dandiest utility around. Way to go guys! -- ...{watmath|allegra|decvax|ihnp4|linus}!utzoo!oscvax!rico or oscvax!rico@gpu.toronto.EDU if you're lucky [NSA food: terrorist, cryptography, DES, drugs, CIA, secret, decode] [CSIS food: supermailbox, tuna, fiberglass coffins, Mirabel, microfiche] [Cat food: Nine Lives, Cat Chow, Meow Mix, Crave]