From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,cceb19dbd864b8da X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-07-01 07:07:36 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!wn1feed!worldnet.att.net!135.173.83.71!wnfilter1!worldnet-localpost!bgtnsc06-news.ops.worldnet.att.net.POSTED!not-for-mail Message-ID: <3B3F2F39.50BAF3CF@worldnet.att.net> From: James Rogers X-Mailer: Mozilla 4.76 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Unix-daemons in Ada References: <87sngg3jp8.fsf@520075220525-0001.dialin.t-online.de> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Sun, 01 Jul 2001 14:07:36 GMT NNTP-Posting-Host: 12.86.33.172 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc06-news.ops.worldnet.att.net 993996456 12.86.33.172 (Sun, 01 Jul 2001 14:07:36 GMT) NNTP-Posting-Date: Sun, 01 Jul 2001 14:07:36 GMT Organization: AT&T Worldnet Xref: archiver1.google.com comp.lang.ada:9295 Date: 2001-07-01T14:07:36+00:00 List-Id: This is much easier using tasks in Ada. In the Ada task there will be no forking. Instead, a task will be created to handle the work. You have several options in your task design. You can dynamically create (and destroy) tasks as you need them, or you can create a pool of tasks that get used over and over. The task pool approach is more complicated to manage, but limits the amount of memory required for your program. The dynamic creation approach is easier to manage, but expands memory usage in an uncontrolled manner. Using the dynamic task approach you would do the following: 1) Declare a task type that perfoms your "real work" 2) Have the main process create an instance of the task type as needed for the service. 3) Pass necessary data to the task instance through an entry call. At this point the task will do its work, and the main procedure can loop back to monitoring its inputs so that it can start another task as needed. Jim Rogers Colorado Springs, Colorado USA Stefan Nobis wrote: > > Hi. > > I'm learning Ada and i tried to write a simple Unix daemon in Ada (a very > simple web server). I want the main process, which is attached to a tty, to > exit, something like > > if (fork()) exit 0; > else do_real_work(); > > in C. I played a little bit with Adas Tasks, but i have no clue how to > implement the above in Ada. > > -- > Until the next mail..., > Stefan.