Path: utzoo!attcan!uunet!seismo!sundc!pitstop!sun!amdcad!ames!killer!elg From: elg@killer.UUCP (Eric Green) Newsgroups: comp.sys.amiga Subject: Re: GaaaK! Unix networking called "GOOD"?!? Message-ID: <4072@killer.UUCP> Date: 13 May 88 06:38:02 GMT References: <538@viscous> Organization: The Unix(R) Connection, Dallas, Texas Lines: 52 in article <538@viscous>, brianm@sco.COM (Brian Moffet) says: > However, the ability to handle fork() and a common set of > InterProcess Communications between child and parent > process would help greatly. Done. There is a "spawn" command in AmigaDos, which can spawn an independent process (I don't have my manuals here at home, so I can't tell you the exact format -- it's part of the grody BCPL crud, unless you do a LoadSeg and set up a lightweight task at the Exec level, instead). Before you spawn, do a CreatePort("math.myport",0); Your brand new task then does a FindPort("math.myport"); and then sits in a loop, the first instruction of which is a WaitPort(portpointer) which puts the process to sleep until there's a message coming in. Have yourself two kinds of messages: a transaction message, and a cleanup message. The transaction message basically has a flag saying "do it!" and a bundle of parameters. Your spawned task does a GetMsg, does its duty, then does a ReplyMsg with the answer. When finished, just send a quit, wait for the reply, unallocate all memory and signals associated with the port, and go on to whatever. (NOTE AGAIN: I DO NOT HAVE MY MANUALS WITH ME. THE ABOVE IS A SIMPLIFICATION OFF THE TOP OF MY HEAD, BASED UPON A WHOLE TWO WEEKS OF AMIGA PROGRAMMING EXPERIENCE). > An easy way to handle this is to have your parent program > write and compile a secondary program in the back ground while > asking the user for parameters. Once the secondary program > is compiled (found out by wait()), do a fork and dup() to > force the child process to talk via a pipe to the parent > process. The parent can then give the child a set of > paramters to the equation, and the child responds with the > answer. Very simple, but with a lot of overhead. Functionally equivalent to the Amiga stuff mentioned above, except it may take some AmigaDOS munging to figure a way of finding when the compiler is finished doing it's exec()'ed chores. Maybe something to do with write locks and not being able to read a file that has a write lock upon it? Keep trying to get a read lock until you can do it? ARGH! BCPL! BPTR'S! KILLKILLKILL! > Oh well, sorry for rambling, I thought I would give an example > of what I have done under Unix but not been able to do under > the amiga. Oh well. Keep on trying. It takes awhile. One thing I'd suggest is reading the appropriate sections of the documentation thoroughly, while referencing a third-party manual and the "include" files and the autodocs. The Amiga is an amazingly open-ended machine -- it's possible to do almost anything, with a little effort and a decent understanding of what's going on. -- Eric Lee Green {cuae2,ihnp4}!killer!elg Snail Mail P.O. Box 92191 Lafayette, LA 70509 "Is a dream a lie that don't come true, or is it something worse?"