comp.lang.ada
 help / color / mirror / Atom feed
From: Andre Heidenreich <heidenae@trick.informatik.uni-stuttgart.de>
Subject: problem with tasking (ada95)
Date: 1998/04/29
Date: 1998-04-29T00:00:00+00:00	[thread overview]
Message-ID: <Pine.SOL.3.95.980429173033.19614A-100000@trick> (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                             --





             reply	other threads:[~1998-04-29  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-04-29  0:00 Andre Heidenreich [this message]
1998-05-04  0:00 ` problem with tasking (ada95) Lowe Anthony A
1998-05-09  0:00 ` Dr. Hubert B. Keller
replies disabled

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