[comp.sys.amiga.tech] Writing programs for background tasks

bga@pnet51.orb.mn.org (Bruce Albrecht) (08/20/90)

I want to have a program start up from the CLI, but after it has started, I
want the CLI to be able to terminate, even though the program has not
completed.  How can I do this?  Is it documented in the RKM's or in any of
the Amiga programming books?


UUCP: {amdahl!bungia, uunet!rosevax, crash}!orbit!pnet51!bga
ARPA: crash!orbit!pnet51!bga@nosc.mil
INET: bga@pnet51.orb.mn.org

griffith@eecs.cs.pdx.edu (Michael Griffith) (08/20/90)

I have absolutely no idea from your original article what language you
are programming in. But, if you are using Manx Aztec C (my version is 3.6a),
a feature was provided to supply this capability. First, you declare four
long integers at the beginning of your program:

long _stack=<value>; /* size of stack to use, 0 to use current CLI value */
long _priority=<value>; /* priority to run at (normally 0) */
long _BackGroundIO=<value>; /* nonzero if output to CLI console is needed */
char *_procname="<name>"; /* string containing name of the new process */

You then link detach.o to your program, which takes care of detaching your
program from it's initial CLI, optionally running it in the background.

                                  Michael Griffith
                                  griffith@eecs.ee.pdx.edu
                                  uunet!tektronix!psueea!eecs!griffith
                                  "Say, 'I will not program in Pascal.'"

arc@desire.wright.edu (08/20/90)

In article <3066@orbit.cts.com>, bga@pnet51.orb.mn.org (Bruce Albrecht) writes:
> I want to have a program start up from the CLI, but after it has started, I
> want the CLI to be able to terminate, even though the program has not
> completed.  How can I do this?  Is it documented in the RKM's or in any of
> the Amiga programming books?
> 
> 
> UUCP: {amdahl!bungia, uunet!rosevax, crash}!orbit!pnet51!bga
> ARPA: crash!orbit!pnet51!bga@nosc.mil
> INET: bga@pnet51.orb.mn.org

   When you want to write a program that lets you close the CLI, you can use
CreateProc(), which is a great way to do it, because the user doesn't need to
issue a run command.

walker@unx.sas.com (Doug Walker) (08/28/90)

In article <3066@orbit.cts.com> bga@pnet51.orb.mn.org (Bruce Albrecht) writes:
>I want to have a program start up from the CLI, but after it has started, I
>want the CLI to be able to terminate, even though the program has not
>completed.  How can I do this?  Is it documented in the RKM's or in any of
>the Amiga programming books?
>

You can do this in Lattice C (or SAS/C) by linking your program with the
cback.o startup instead of c.o.  If you're using SAS/C or Lattice C, check
out the docs on cback.o.


  *****
=*|_o_o|\\=====Doug Walker, Software Distiller====== BBS: (919)460-7430 =
 *|. o.| ||
  | o  |//     For all you do, this bug's for you!
  ====== 
usenet: ...mcnc!rti!sas!walker   plink: dwalker  bix: djwalker