Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!ncar!gatech!mcnc!wolves!deepthot!Jay From: Jay@deepthot.UUCP (Jay Denebeim) Newsgroups: comp.sys.amiga.programmer Subject: Re: HELP with Independant Children Processes Message-ID: Date: 5 Feb 91 15:20:03 GMT References: <1991Feb4.171549.28531@nntp-server.caltech.edu> Organization: The Software Distillery Lines: 85 In article <1991Feb4.171549.28531@nntp-server.caltech.edu> tll@nntp-server.caltech.edu (Tal Lewis Lancaster) writes: >I have the following requiremnts: > >A parent process that starts up children processes and waits for them >before continuing. The child might require up to 50 arguments. These >arguments concatenated togther could total 1000 characters. The parent >needs to know if the child succeeded or failed (ie. returns 0 if okay, >anything else if failed). Here's the catch the child must be an independant >program capable of being run on its own from CLI (just like COPY, MAKEDIR, etc.) Under 2.0 you've got two choices: System() Execute() System executes syncronously, and returns the return code of the child task to the caller. Execute executes asyncronously, and returns success of the launching of the program. So, if you need to launch several processes at the same time, execute is your only choice. If only one process is needed, System will do what you want. As far as passing parameters go, I would suggest concidering opening up a public port, and have the child ask for the parameters. You have to open a port anyway in the execute case, as there is no mechinism defined to return the return code in the Execute case. If I was writing the code, it would go something like this: Parent: Open port Execute child (either passing the address of the port on the command line, or the name of the port if public) Forever Wait on Port While message available Process message If message=child complete break; end end Child: Find Port Ask for Parms Do my thing Tell parent byebye exit In the system case: Parent: rc = System child Child: do my thing return rc It all depends on what you want to do. Since I like multi-tasking, I'd probably start the child and then do more work while the child was doing its thing. > >Which Amiga function will I need to call in the parent program to start up >the child to accomplish this? It can be either 1.3 or 2.0. > >Does anybody know the string length limit for the 2.0 System() call? Is it the >same as a CLI command 256? Sorry, don't know for sure. Reading between the lines of the autodoc, I'd say same limitations as the CLI, but I'm not sure that the 256 byte limit in the CLI is still there. Its not BCPL anymore. > >Thanks in advance, > >Tal Lancaster >tll@tybalt.caltech.edu -- |_o_o|\\ |. o.| || The Jay Denebeim | . | || Software | o | || Distillery | |// Address: mcnc!wolves!deepthot!jay ====== BBS:(919)-460-7430 VOICE:(919)-460-6934