comp.lang.ada
 help / color / mirror / Atom feed
* Question on Tasking and Text_IO
@ 1988-01-07  3:27 Karl A. Nyberg
  0 siblings, 0 replies; 2+ messages in thread
From: Karl A. Nyberg @ 1988-01-07  3:27 UTC (permalink / raw)


[Ed. - this is being forwarded becuase the original sender is having
difficulty with the ARPANET.  p.s. to P. S. - let me know that you see
this.]

------------------------------------------------------------------------
Help!

I have been attempting to use Tasking in my work in real-time signal 
processing on VAX/VMS, ALSYS and Meridian Ada compilers.  One task (the 
main program) is dedicated to handling user interaction, and other tasks 
run around doing the real-time stuff.  I came across a problem on the 
Alsys system where once entry of a data field was started, the other 
tasks in the system freeze, and the PC seems to be totally dedicated to 
handling the user input.  I tried this on the DEC VAX/VMS and Meridian 
compilers, and ended up with three different responses, one for each 
compiler. 

What gives?  Am I missing something big, or does Ada not care whether a 
single task performing Text_IO calls can block the reset of a system?  
The code fragment which follows illustrates the three responses that 
were obtained (P.S. in the actual program I use a mailbox and not a 
shared variable!):

The three classes of response were:

DEC VAX/VMS: 		with $ DEFINE ADA$INPUT TT: the A_Task updates 
                        the shared variable at 10 Hz, as expected.

ALSYS on SPERRY-IT	Correct updating of the shared variable until 
                        the first character of the command is entered, 
                        then A_Task freezes.  Time-slicing does not 
                        help.

MERIDIAN on COMPAQ-386	The shared variable is never updated.  Pragma 
                        Priority does not help.

Does this also mean that I have to provide a machine-dependent mechanism 
for user interaction in the presence of tasking?  I would appreciate any 
comments on this dilemma.

P.S.Tuffs

CS-NET:	Tuffs@alcoa.com
Mail:	P.S.Tuffs
	Alcoa Technical Center,
	Alcoa Center
	Pa 15069.

-------------------------------------------------------------------------------
-- An example of how the Text_IO.Get for enumerations can block a task
with Text_Io;
procedure Task_Blk is
  
  Shared_Variable: Integer := 0;
  task A_Task is
    entry Stop;
  end A_Task;

  type Commands is (Help, Stop);
  The_Command: Commands;
  package Command_Io is new Text_Io.Enumeration_IO(Commands);

  task body A_Task is
  begin 
    loop
      select
        accept Stop;
        exit;
      or
        delay 0.1;
        Shared_Variable := Shared_Variable + 1;
      end select;
    end loop;
  end A_Task;

begin
  loop
    Text_IO.Put("Enter the command: ");
    Command_IO.Get(The_Command);
    exit when The_Command = Stop;
    Text_Io.Put_Line("The variable is: " & Integer'Image(Shared_Variable));   
  end loop;    
  A_Task.Stop;
end Task_Blk;
-------------------------------------------------------------------------------

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

end of thread, other threads:[~1988-01-08 15:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <18242@grebyn.com>
1988-01-08 15:31 ` Question on Tasking and Text_IO stt
1988-01-07  3:27 Karl A. Nyberg

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