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

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