Re: Need a Sanity Check



I believe the output you get from this program is dependent on the runtimes
implementation of Text_IO.

The old ARM 9.5.1:
During a protected action, it is a bounded error to invoke an operation
that is potentially blocking. The following are defined to be potientially
blocking operations:

an accept_statement

a call on a subprogram whose body contains a potnentially blocking
operation.

I believe the calls to Text_IO may be potentially blocking. A language
lawyer may be able to help with this.

To get away from this restriction you might see if changing the source from:

accept Three do
Text_Io.Put_Line( "Three" );
end;

To:

accept Three do
null;
end;
Text_Io.Put_Line( "Three" );

Or just

accept Three;
Text_Io.Put_Line( "Three" );

to see if this changes the behavior.

Whether it is right or wrong, I have a note in my mind to only do simple
things like copying data inside of an accept statement.

Steve
(The Duck)


"autstspe" <ati@xxxxxxxxxx> wrote in message
news:1115772555.000422.205200@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Hello. I'm seeing some strange behavior from an Ada95 program. I've
> spoken to several people I work with and we all agree it should not
> behave the way it does. Its a simple program so I was wondering if
> someone could take a look at the following an tell me what the output
> should be. It should take just a minute. Unfortunately, due to
> restrictions, I can't say much more. Thanks.
>
> ==========================================================================
> package T123_Pack is
>
> task type Three_Entries_Type is
> entry Start ;
> entry One ;
> entry Two ;
> entry Three ;
> end Three_Entries_Type ;
>
> Three_Entries : Three_Entries_Type ;
>
> procedure Start ;
>
> end T123_Pack ;
> --------------------------------------
> with Text_Io ;
> package body T123_Pack is
>
> task body Three_Entries_Type is
>
> begin
>
> accept Start ;
>
> Text_Io.Put_Line("Start");
>
> loop
>
> select
>
> accept One do
>
> Text_Io.Put_Line("One");
>
> end ;
>
> or
>
> accept Two do
>
> Text_Io.Put_Line("Two");
>
> end ;
>
> or
>
> accept Three do
>
> Text_Io.Put_Line("Three");
>
> end ;
>
> loop
> null ;
> delay(0.02);
> end loop ;
>
> end select ; -- select
>
> end loop ;
>
> end Three_Entries_Type ;
>
> procedure Start is
>
> begin
> Three_Entries.Start ;
> end ;
>
> end T123_Pack ;
>
> --------------------------------------
> -- main procedure
> --------------------------------------
> with T123_Pack ;
>
> procedure T123 is
>
> begin
>
> T123_Pack.Three_Entries.Start ;
> T123_Pack.Three_Entries.Three ;
> T123_Pack.Three_Entries.One ;
>
> loop
> T123_Pack.Three_Entries.Three ;
> T123_Pack.Three_Entries.Two ;
> delay(0.02) ;
> end loop ;
>
> end T123 ;
>


.



Relevant Pages

  • Re: PAR (Was: Embedded languages based on early Ada)
    ... task type Integrate is ... entry Result; ... for K in T'Range loop ...
    (comp.lang.ada)
  • RE: Creating a que
    ... and entry count in a collection. ... if eo.Count> 0 then bMoreData = True ... At the beginning of the loop you assume this is the last time through the ... Then you go through each item in the Entries ...
    (microsoft.public.excel.programming)
  • RE: Creating a que
    ... and entry count in a collection. ... if eo.Count> 0 then bMoreData = True ... At the beginning of the loop you assume this is the last time through the ... Then you go through each item in the Entries ...
    (microsoft.public.excel.programming)
  • Re: Very confused by Ada tasking, can not explain the execution outcome.
    ... I am trying to simulate a concurrent resource allocator with Ada's ... task and protected type. ... entry calls, so no entry is defined in tasks. ... loop, 'while rounds<2 loop', how could it get out of the loop if ...
    (comp.lang.ada)
  • Re: How to Delete Rows in Excel In a Do Loop
    ... have to delete there are some that have a entry in each and every cell ... Richard Buttrey wrote: ... time you go through the loop. ... Now copy this formula down column A for the whole database ...
    (microsoft.public.excel.worksheet.functions)