TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy

TEAM-ADA@LISTSERV.ACM.ORG

Options: Use Forum View

Use Proportional Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Matthew Heaney <[log in to unmask]>
Reply To:
Matthew Heaney <[log in to unmask]>
Date:
Tue, 2 Mar 2004 10:38:51 -0500
Content-Type:
text/plain
Parts/Attachments:
text/plain (34 lines)
[log in to unmask] wrote:

> hi alex,
>             Shiva here. I have done a small program which uses protected
> and 2 tasks. Check this, but this program works........
>
> with Ada.Text_Io;
> use  Ada.Text_Io;
>
> procedure Protected_Task is
>    protected Task_Var is
>       procedure Increment;
>    private
>       A : Integer:=0;
>    end Task_Var;
>
>    protected body Task_Var is
>       procedure Increment is
>       begin
>          A:=A+1;
>          New_Line;
>          Put(" A value :");
>          Put(Integer'Image(A));
>       end Increment;
>    end Task_Var;


This program is of course broken, per RM95 9.5.1 (18).

Text_IO.Put is potentially blocking, so calling it from within a
protected operation is a bounded error.  See RM95 9.5.1 (16).

-Matt

ATOM RSS1 RSS2