Previous: libstubs.a, Up: Features


6.6 Detaching from the current CLI

Some people like multitasking that much that they tend to start everything in the background. Some tools are able to do this automatically - and with libnix you can write such tools, too. 1

To be able to detach from the current CLI the detach module has to know how much stack your program needs, how to call the new process, etc. Therefore you will have to provide some global variables that contain this information. If you don't provide them you will get default values (don't blame me for them - it's your own fault :-} ).

Here is an example set of variables:

     char *__procname="My nifty tool";
     long __priority=-1;	   /* We don't eat that much processor time */
     unsigned long stack=50000; /* but need a large stack		    */

Footnotes

[1] Please be aware that you lose the ability to synchronize your tool with the calling CLI - this can be very nasty if one needs to. Use this feature very sparse: Most of the time it's better to just rely on the user being able to type ‘Run >NIL: <NIL:’.