[comp.sys.amiga] Process spawning

waggoner%dtg.nsc.com@cunyvm.cuny.edu (12/15/89)

In article <288@egrunix.UUCP> cogswell@unix.secs.oakland.edu (Dan Cogswell)
 writes:
>Simple question:  I have written a clock/memory monitor thingy that opens
>a small window in the corner and sits there forever.  I can AmigaDOS RUN
>it and everything works fine, but I'd like to detach it from a CLI ala
>DMouse.  I assumed you could do this with LoadSeg() and CreateProc(), and
>these two functions work (ie. they return valid), but my clock never appears.
>Why not?  Xoper shows the process WAITING.
>
>I'm using Benchmark Modula, BTW.  Does it have something to do with the
>startup code of the load module?

I'm not familiar with Modula2, but you probably need to send it a
startup message along the lines of a workbench startup message.  Most
startup code Wait()'s for this message when it sees that it has been
started via CreateProc().  The problem with this is that the code that
sends the startup message really should wait around for it to reply to
the message, which is normally done when the program exits.  If you
want to use LoadSeg() and CreateProc() you are probably going to have
to find out how the startup code for your language works and
substitute in some custom code of your own that works some other way.

An alternative, which I've used but don't know how nice it is, is to
(again) substitute in your own startup code that, when started from a
CLI, clones your process and prevents the code from being unloaded
by NULLing the seglist pointer in the CLI structure.  I don't remember
all the details, but I believe the basics of it were in the robotroff
(or something like that) program on an early fish disk.  The
advantage of this is that you don't have to have two programs (one to
load the clock and the clock itself).

I can send you C source code if you are interested.

>--
>Dan Cogswell                         | 9-Lives...      | No,
>(313)625-3234                        | Everything else | I *don't*
>INET: cogswell@unix.secs.oakland.edu | is just         | understand
>UUCP: cogswell@egrunix.UUCP          | cat food.       | alt.slack!!!


--
 ,------------------------------------------------------------------.
|  Mark Waggoner   (408) 721-6306           waggoner@dtg.nsc.com     |
 `------------------------------------------------------------------'