From: Jean-Baptiste CAMPESATO <camje_lemon@nospam.a2lf.org>
Subject: Re: "multithread"
Date: Sun, 03 Apr 2005 09:30:32 +0200
Date: 2005-04-03T09:28:34+02:00 [thread overview]
Message-ID: <pan.2005.04.03.07.30.31.314673@nospam.a2lf.org> (raw)
In-Reply-To: YKH3e.36084$cg1.25536@bgtnsc04-news.ops.worldnet.att.net
Le Sun, 03 Apr 2005 01:34:48 +0000, Jim Rogers a ᅵcritᅵ:
> Jean-Baptiste CAMPESATO <camje_lemon@nospam.a2lf.org> 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 :)
next prev parent reply other threads:[~2005-04-03 7:30 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-02 22:37 "multithread" Jean-Baptiste CAMPESATO
2005-04-03 1:34 ` "multithread" Jim Rogers
2005-04-03 7:30 ` Jean-Baptiste CAMPESATO [this message]
2005-04-03 7:12 ` "multithread" Martin Dowie
2005-04-03 8:40 ` "multithread" Martin Krischik
2005-04-03 9:07 ` "multithread" Jean-Baptiste CAMPESATO
2005-04-03 11:13 ` "multithread" Martin Krischik
2005-04-03 12:14 ` "multithread" Jean-Baptiste CAMPESATO
2005-04-03 13:42 ` "multithread" Adrian Knoth
2005-04-03 13:24 ` "multithread" Jean-Baptiste CAMPESATO
2005-04-03 22:27 ` "multithread" Jeffrey Carter
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox