comp.lang.ada
 help / color / mirror / Atom feed
From: Florian Weimer <fw@deneb.enyo.de>
Subject: Re: Unix-daemons in Ada
Date: 01 Jul 2001 21:51:39 +0200
Date: 2001-07-01T21:51:39+02:00	[thread overview]
Message-ID: <878zi8whpw.fsf@deneb.enyo.de> (raw)
In-Reply-To: 87sngg3jp8.fsf@520075220525-0001.dialin.t-online.de

Stefan Nobis <stefan@snobis.de> writes:

> 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.

Usually, you can't call fork() from Ada and do complicated things in
the child process (besides an execve()).  This has to do with the fact
that most fork() implementations don't duplicate the whole process
(only the current thread of execution), and that the runtime might
have stored PIDs which become outdated after this operation.

So it's best to detach *before* the Ada runtime is initialized.  How
you can achieve this depends on your Ada implementation.



  parent reply	other threads:[~2001-07-01 19:51 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-01 12:41 Unix-daemons in Ada Stefan Nobis
2001-07-01 14:07 ` James Rogers
2001-07-01 14:35   ` Stefan Nobis
2001-07-01 17:20     ` James Rogers
2001-07-03 20:48       ` Stefan Skoglund
2001-07-03 22:39         ` Larry Kilgallen
2001-07-06 14:15           ` Tarjei T. Jensen
2001-07-06 17:05             ` Larry Kilgallen
2001-07-06 22:33               ` Tarjei Tj�stheim Jensen
2001-07-13  7:51                 ` Maxim Reznik
2001-07-01 19:51 ` Florian Weimer [this message]
2001-07-01 21:47 ` David C. Hoos, Sr.
2001-07-02 19:18   ` Stefan Nobis
2001-07-02 20:16     ` David C. Hoos
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox