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-Thread: 103376,bf6902412865b202 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news1.google.com!proxad.net!193.252.118.146.MISMATCH!news.wanadoo.fr!news.wanadoo.fr!not-for-mail From: Jean-Baptiste CAMPESATO Organization: a2lf - Association pour le Logiciel Libre Francophone Subject: Re: "multithread" Date: Sun, 03 Apr 2005 09:30:32 +0200 User-Agent: Pan/0.14.2.91 (As She Crawled Across the Table) Message-Id: Newsgroups: comp.lang.ada References: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 8bit NNTP-Posting-Date: 03 Apr 2005 09:28:34 CEST NNTP-Posting-Host: 83.200.98.117 X-Trace: 1112513314 news.wanadoo.fr 25024 83.200.98.117:32820 X-Complaints-To: abuse@wanadoo.fr Xref: g2news1.google.com comp.lang.ada:10240 Date: 2005-04-03T09:28:34+02:00 List-Id: Le Sun, 03 Apr 2005 01:34:48 +0000, Jim Rogers a �crit�: > Jean-Baptiste CAMPESATO wrote in > news:pan.2005.04.02.22.37.39.88996@nospam.a2lf.org: > >> Hello, >> I want to create a function wich can called "several times at the same >> time", MultiThread. >> I found task and i tested : >> In ADS : >> -- Tache pour le traitement du client >> task Traitement is >> entry Go(Client:Socket_Type); >> end Traitement; >> ----------------------------------------------- >> In ADB : >> task body Traitement is >> begin >> accept Go(Client:Socket_Type) do >> put_line("Tache."); >> Close_Socket(Client); >> end Go; >> end Traitement; >> ------------------------------------------------ >> In the loop wich call Traitement: >> loop >> -- On accepte le client >> Accept_Socket (Server, Client, Address); >> -- Et on cr�� un thread pour lui >> Traitement.Go(Client); >> end loop; >> >> >> And the first time i call the task it's Ok, but at the second time i've > a >> "TASKING_ERROR". > Task Traitement terminates at the end of its first execution. Tasks are > not > callable after they terminate. You need to create a loop in the > Traitement > to allow it to accept the Go entry as many times as necessary. > > task body Traitement is > begin > loop > select > accept Go(Client : Socket_Type) do > Put_Line("Tache."); > Close_Socket(Client); > or > terminate; > end select; > end loop; > end Traitement; > > > The selective accept with a terminate alternative should provide you > with the functionality you want. The task will continue to loop through > the selection of the entry Go until the the task that calls the Go entry > terminates. Task Traitement will then automatically terminate cleanly. > > Jim Rogers Thanks a lot for Jim Rogers and Martin Dowie :)) It's ok :)