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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!d34g2000vbm.googlegroups.com!not-for-mail From: =?UTF-8?Q?Tomek_Wa=C5=82kuski?= Newsgroups: comp.lang.ada Subject: Re: Ada and (SIGTERM?) Date: Sat, 8 Aug 2009 06:11:28 -0700 (PDT) Organization: http://groups.google.com Message-ID: <103641e8-0738-4b10-b2c6-cbfb53b50d98@d34g2000vbm.googlegroups.com> References: <42c9446c-76d2-4c82-abab-fd7c5573d85e@k30g2000yqf.googlegroups.com> <4244cbe7-1655-484b-a376-0237802ab37d@p10g2000prm.googlegroups.com> NNTP-Posting-Host: 79.185.181.228 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1249737092 3563 127.0.0.1 (8 Aug 2009 13:11:32 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sat, 8 Aug 2009 13:11:32 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: d34g2000vbm.googlegroups.com; posting-host=79.185.181.228; posting-account=Ar5oKAoAAAD4cyp5eTv5CtR88dGtUxxC User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; pl-PL; rv:1.9.1.2) Gecko/20090803 Fedora/3.5.2-2.fc11 Firefox/3.5.2,gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:7659 Date: 2009-08-08T06:11:28-07:00 List-Id: > protected type Interrupt_Handler is > =A0 =A0procedure Handler; > =A0 =A0pragma Attach_Handler (Handler, 15); -- is it correct for SIGTERM? > > =A0 =A0function Quit return Boolean; > private > =A0 =A0Q : Boolean :=3D False; > end Interrupt_Handler; > > protected body Interrupt_Handler is > =A0 =A0procedure Handler is > =A0 =A0begin > =A0 =A0 =A0 Q :=3D True; > =A0 =A0end Handler; > > =A0 =A0function Quit return Boolean is > =A0 =A0begin > =A0 =A0 =A0 return Q; > =A0 =A0end Quit; > end Interrupt_Handler; > > Then... somewhere Interrupt_Handler is declared and loop looks like: > > while not Quit loop > =A0 =A0Do_Something; > end loop; > I cannot stop task if Do_Something is Accept_Socket from GNAT.Sockets. There is a listener which waits for client connections and then delegates jobs to the worker tasks. I want to stop all tasks and finalize all objects when SIGTERM is fired.