comp.lang.ada
 help / color / mirror / Atom feed
* help in task, what is wrong?
@ 2005-04-24 13:02 mferracini
  2005-04-24 14:02 ` Ed Falis
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: mferracini @ 2005-04-24 13:02 UTC (permalink / raw)


sorry for the italian source code:

----
with Ada.Text_Io;

procedure Interazione is --processo genitore


   task type Generico is
      entry Init;
      entry Esegui;
   end Generico;

type Ptr_Generico is access Generico;

   task type Schedulatore is
      entry Addtask( my_task : in ptr_Generico);
      entry Parti;
   end Schedulatore;


   task body Generico is
      N2 : Integer;
   begin
      accept Init do
         Ada.Text_Io.Put_Line("Init del task " &Integer'Image(N2));
         end Init;
      loop
         accept Esegui do
         Ada.Text_Io.Put_Line("-Work task " &Integer'Image(N2));
         delay(0.2);
         --exit; --misteri
         end Esegui;
      end loop;
   end Generico;

   task body Schedulatore is
     begin
      accept Parti;
        accept Addtask( My_Task : in ptr_Generico) do
           My_Task.Esegui;
           end addtask;
      null;
   end;

task_x : Ptr_Generico;

  begin --corpo genitore
     Schedulatore.Parti;
   Task_X:=new Generico;
   Task_x.Init;
   schedulatore.Addtask(Task_X);
end Interazione;

---
 schedulatore.Addtask(Task_X); give me this error:
invalid use of subtype mark.

how i can pass the task pointer? thanks




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

* Re: help in task, what is wrong?
  2005-04-24 13:02 help in task, what is wrong? mferracini
@ 2005-04-24 14:02 ` Ed Falis
  2005-04-24 14:09 ` Adrien Plisson
  2005-04-24 18:19 ` Martin Dowie
  2 siblings, 0 replies; 5+ messages in thread
From: Ed Falis @ 2005-04-24 14:02 UTC (permalink / raw)


Do you really want Schedulatore to be a task _type_ rather than a task  
object?

- Ed



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

* Re: help in task, what is wrong?
  2005-04-24 13:02 help in task, what is wrong? mferracini
  2005-04-24 14:02 ` Ed Falis
@ 2005-04-24 14:09 ` Adrien Plisson
  2005-04-24 15:28   ` mferracini
  2005-04-24 18:19 ` Martin Dowie
  2 siblings, 1 reply; 5+ messages in thread
From: Adrien Plisson @ 2005-04-24 14:09 UTC (permalink / raw)


mferracini wrote:
>    task type Schedulatore is

you declared Schedulatore as a task TYPE, but did not declare any object 
of this type to use for AddTask.

either it should ba a simple task (not a task type), or you should 
declare an object of type Schedulatore.

>  schedulatore.Addtask(Task_X); give me this error:
> invalid use of subtype mark.

btw, this error does not say that the problem is in passing the pointer: 
it says you misused the name of a type, in this case Schedulatore.

-- 
rien




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

* Re: help in task, what is wrong?
  2005-04-24 14:09 ` Adrien Plisson
@ 2005-04-24 15:28   ` mferracini
  0 siblings, 0 replies; 5+ messages in thread
From: mferracini @ 2005-04-24 15:28 UTC (permalink / raw)


oh o_0" 
that is a mistake, sorry i'm a dummy....

tanks




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

* Re: help in task, what is wrong?
  2005-04-24 13:02 help in task, what is wrong? mferracini
  2005-04-24 14:02 ` Ed Falis
  2005-04-24 14:09 ` Adrien Plisson
@ 2005-04-24 18:19 ` Martin Dowie
  2 siblings, 0 replies; 5+ messages in thread
From: Martin Dowie @ 2005-04-24 18:19 UTC (permalink / raw)


mferracini wrote:
> sorry for the italian source code:
> 
> ----
> with Ada.Text_Io;
> 
> procedure Interazione is --processo genitore
> 
> 
>    task type Generico is
>       entry Init;
>       entry Esegui;
>    end Generico;
> 
> type Ptr_Generico is access Generico;
> 
>    task type Schedulatore is
[snip]
>  schedulatore.Addtask(Task_X); give me this error:
> invalid use of subtype mark.
> 
> how i can pass the task pointer? thanks

It isn't the parameter that's the problem. "Schedulartore" is a task 
_type_ - you haven't created an instance of the type yet.

Cheers

-- Martin



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

end of thread, other threads:[~2005-04-24 18:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-24 13:02 help in task, what is wrong? mferracini
2005-04-24 14:02 ` Ed Falis
2005-04-24 14:09 ` Adrien Plisson
2005-04-24 15:28   ` mferracini
2005-04-24 18:19 ` Martin Dowie

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