From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,abaec53fd41aec4e,start X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!proxad.net!fr.ip.ndsoftware.net!news.newsland.it!ilaria.aioe.org!aioe.org!not-for-mail From: Thomas Ruschival Newsgroups: comp.lang.ada Subject: I don't know what the compiler wants to tell me Date: Thu, 3 Nov 2005 21:47:59 +0100 Organization: disorganized Message-ID: <20051103214759.6d049f90@localhost> NNTP-Posting-Host: aqmg4u7YzXn97r7IX703xA.816.domitilla.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org X-Newsreader: Sylpheed-Claws 1.9.99 (GTK+ 2.8.6; i686-pc-linux-gnu) Xref: g2news1.google.com comp.lang.ada:6157 Date: 2005-11-03T21:47:59+01:00 List-Id: Hi Group I just wrote a sample program in which I wanted to understand how it works with task type and instatiating tasks of that type. Now I run into a strange Compiler error I don't understand: hello2b.adb:48:18: left hand of assignment must not be limited Basically all I wanted to do is have a task running until another task does a rendevouz and interrupts exactly that task. I wanted it configurable so I first chose to configure it in the disciminants which didn't work. Now I pass the task to be controlled at a rendevouz point to the controller, this should copy it into a local variable to keep the rendevouz as short as possible and then control the task to which the local variable points to.... as I write this the question arises: does ada pass by value or by reference? I appreciate any comments on how you do rendevous with task you don't know yet at the time of writing, lets say you just know the access points of that task type but you want to make rendevous with different instances of that type, so you need to tell this either at point where you instantiate the task that calls the entry point or at another point you have to tell the task which object to meet Thanks Thomas Ruschival Here is the code: with Text_IO, Calendar; use Calendar; procedure Hello2b is task type PrinterTask is entry Interrupt; end PrinterTask; task type ControlTask is entry Start(ToControl : in PrinterTask); end ControlTask; ------ Hello Task to do the important work of printing "Hello" to Console task body PrinterTask is SamplingTime : Duration := 2.0; NextActivation : Calendar.Time ; irq : Boolean := False; begin while Irq = False -- infinite loop until an external task does -- a rendevouz to interrupt loop -- next activation will be SamplingTime from now NextActivation := Clock + SamplingTime; -- either interrupt occurs or we wait until -- samplingTime is elapsed and print Hello select accept Interrupt; Irq := True; or delay until NextActivation; Text_IO.Put_Line("task running"); end select; end loop; end PrinterTask; ------ ControlTask to interrupt the work of a given Task task body ControlTask is Controlled : PrinterTask; -- task To be controlled begin -- Copy into local variable accept Start(ToControl : in PrinterTask) do Controlled := ToControl; end Start; delay 60.0; -- wait a minute Controlled.Interrupt; -- Now make a rendevouz with the task we want to terminate end ControlTask; -- tasks Printer : PrinterTask; Controller: ControlTask; begin Text_IO.Put_Line("Procedure running...."); Controller.Start(Printer); end Hello2b;