comp.lang.ada
 help / color / mirror / Atom feed
* problem with tasking (ada95)
@ 1998-04-29  0:00 Andre Heidenreich
  1998-05-04  0:00 ` Lowe Anthony A
  1998-05-09  0:00 ` Dr. Hubert B. Keller
  0 siblings, 2 replies; 3+ messages in thread
From: Andre Heidenreich @ 1998-04-29  0:00 UTC (permalink / raw)



hi all comp.lang.ada.reader,

could anyone tell me, why the tasking in the followed source didn't work.
the complatiton works correct, but when it was executed, the task of type
clienttasktyp didn't want to start although the 'server' task send out
an entry call ...Starten(-1).

the sourcecode is not absolutely completely.  

thank you.


--------------------------
with Text_IO; use Text_IO;
with vg; use vg;

procedure Spiel is

task type ClientTaskTyp is
  entry Starten(FirstPlayer : SpielerTyp);
  entry Spielen;
  entry Quit;
end ClientTaskTyp;

-------------------------
-- task Clients
-------------------------

task body ClientTaskTyp is
  ...
  ActivePlayer : SpielerTyp;
  ...


begin
    accept Starten(FirstPlayer : in SpielerTyp) do
      ActivePlayer := FirstPlayer;
    end Starten;
      loop
        select
        accept Spielen;
          loop
            Zugnr := Zugnr + 1;
            if ActivePlayer = 1 then                           -- Rechner

                 ...

              UpdateTree(Spielfeld, Zugnr, -1);
              exit;
            end if;
            ActivePlayer := -ActivePlayer;
          end loop;
      or
        accept Quit;
      end select;   
    end loop;       
end ClientTaskTyp;  

------------------------
-- task Server
------------------------

task Server is
  entry Action;
end Server;

task body Server is
package MyInt is new text_io.integer_io(integer);

taskarray      : array (1..10) of ClientTaskTyp;

    ...

procedure CreateClient is
begin
  ActivePlayer := Eingabe;
  RunningClients := RunningClients + 1;
  taskarray(RunningClients).Starten(ActivePlayer);
  taskarray(RunningClients).Spielen;   
end CreateClient;

          ...

begin  -- server task
  loop
    accept Action do
      loop
        ClrScr;
          
          ...
                  Quitall;        
                  quit := true;   
        when others => null;      
      end case;
    end Action;
    exit when quit;
  end loop;
end Server;

---------------------------------------------------

begin -- main
  Server.Action;
  ClrScr;
  new_line;
end Spiel; 
                    

-- heidenae@trick.informatik.uni-stuttgart.de --
-- heid.a@studbox.uni-stuttgart.de            --
-- heid.a@swol.de                             --





^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: problem with tasking (ada95)
  1998-04-29  0:00 problem with tasking (ada95) Andre Heidenreich
@ 1998-05-04  0:00 ` Lowe Anthony A
  1998-05-09  0:00 ` Dr. Hubert B. Keller
  1 sibling, 0 replies; 3+ messages in thread
From: Lowe Anthony A @ 1998-05-04  0:00 UTC (permalink / raw)
  To: Andre Heidenreich


I am not able to completely follow the flow here, I think too much has been
cut out.  Inside the rendezvous there is a loop, but no end to the loop.
Also I can not find where the subprogram 'CreateClient' is being called.
Where does the caller of 'Server' reside?  If you want/can send me more of
the code I would be glad to look at it some more.   From what I can tell the
task type is fine, but with tasking it can be one of a thousand things
causing problems.

--
Tony Lowe                   Rockwell Collins
1431 Opus Place   -  Downers Grove, IL 60515
(630)-960-8603          Fax : (630)-960-8207

Andre Heidenreich wrote:

> hi all comp.lang.ada.reader,
>
> could anyone tell me, why the tasking in the followed source didn't work.
> the complatiton works correct, but when it was executed, the task of type
> clienttasktyp didn't want to start although the 'server' task send out
> an entry call ...Starten(-1).
>
> the sourcecode is not absolutely completely.
>
> thank you.
>
> --------------------------
> with Text_IO; use Text_IO;
> with vg; use vg;
>
> procedure Spiel is
>
> task type ClientTaskTyp is
>   entry Starten(FirstPlayer : SpielerTyp);
>   entry Spielen;
>   entry Quit;
> end ClientTaskTyp;
>
> -------------------------
> -- task Clients
> -------------------------
>
> task body ClientTaskTyp is
>   ...
>   ActivePlayer : SpielerTyp;
>   ...
>
> begin
>     accept Starten(FirstPlayer : in SpielerTyp) do
>       ActivePlayer := FirstPlayer;
>     end Starten;
>       loop
>         select
>         accept Spielen;
>           loop
>             Zugnr := Zugnr + 1;
>             if ActivePlayer = 1 then                           -- Rechner
>
>                  ...
>
>               UpdateTree(Spielfeld, Zugnr, -1);
>               exit;
>             end if;
>             ActivePlayer := -ActivePlayer;
>           end loop;
>       or
>         accept Quit;
>       end select;
>     end loop;
> end ClientTaskTyp;
>
> ------------------------
> -- task Server
> ------------------------
>
> task Server is
>   entry Action;
> end Server;
>
> task body Server is
> package MyInt is new text_io.integer_io(integer);
>
> taskarray      : array (1..10) of ClientTaskTyp;
>
>     ...
>
> procedure CreateClient is
> begin
>   ActivePlayer := Eingabe;
>   RunningClients := RunningClients + 1;
>   taskarray(RunningClients).Starten(ActivePlayer);
>   taskarray(RunningClients).Spielen;
> end CreateClient;
>
>           ...
>
> begin  -- server task
>   loop
>     accept Action do
>       loop
>         ClrScr;
>
>           ...
>                   Quitall;
>                   quit := true;
>         when others => null;
>       end case;
>     end Action;
>     exit when quit;
>   end loop;
> end Server;
>
> ---------------------------------------------------
>
> begin -- main
>   Server.Action;
>   ClrScr;
>   new_line;
> end Spiel;
>
>
> -- heidenae@trick.informatik.uni-stuttgart.de --
> -- heid.a@studbox.uni-stuttgart.de            --
> -- heid.a@swol.de                             --







^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: problem with tasking (ada95)
  1998-04-29  0:00 problem with tasking (ada95) Andre Heidenreich
  1998-05-04  0:00 ` Lowe Anthony A
@ 1998-05-09  0:00 ` Dr. Hubert B. Keller
  1 sibling, 0 replies; 3+ messages in thread
From: Dr. Hubert B. Keller @ 1998-05-09  0:00 UTC (permalink / raw)



It is not possible to check your problem without having the whole source.
Perhaps you send the whole source direct to us and we will check it out.
H.K.

Andre Heidenreich wrote:

> hi all comp.lang.ada.reader,
>
> could anyone tell me, why the tasking in the followed source didn't work.

____________________________________________________________________
Dr. Hubert B. Keller              Forschungszentrum Karlsruhe
                                    - Technik und Umwelt -
++49/7247/82-5756, Fax: -5730     Institut für Angewandte Informatik
e-mail: keller@iai.fzk.de         Postfach 3640, 76021 Karlsruhe

MICS Group - Machine Intelligence for Complex Systems Control
  http://www.iai.fzk.de/Institut/UI/INPRO/inpro.html
The OO-Language Ada95
  http://www.Ada-Deutschland.de/
The German Society of Computer Science
  http://www.gi-ev.de/
____________________________________________________________________






^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1998-05-09  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-04-29  0:00 problem with tasking (ada95) Andre Heidenreich
1998-05-04  0:00 ` Lowe Anthony A
1998-05-09  0:00 ` Dr. Hubert B. Keller

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