From: Laurent <daemon2@internet.lu>
Subject: Strange behavior
Date: Fri, 5 Sep 2014 12:30:49 -0700 (PDT)
Date: 2014-09-05T12:30:49-07:00 [thread overview]
Message-ID: <6967b17b-acb9-4b44-b21a-6ddcab1e1065@googlegroups.com> (raw)
Hi
I have a strange behavior with this simple tasking example:
https://github.com/Chutulu/chapter_17.git
with Ada.Text_IO;
procedure Two_Cooperating_Tasks is
task type Simple_Task (Message : Character; How_Many : Positive);
task body Simple_Task is
begin -- Simple_Task
for Count in 1 .. How_Many loop
Ada.Text_IO.Put ("Hello from Task " & Message);
Ada.Text_IO.New_Line;
delay 0.1;
end loop;
end Simple_Task;
Task_A : Simple_Task (Message => 'A', How_Many => 5);
Task_B : Simple_Task (Message => 'B', How_Many => 5);
begin -- Two_Cooperating_Tasks
null;
end Two_Cooperating_Tasks;
when I run the program I get this:
/Volumes/Kingston/GPS/Chapter 17/Build/two_cooperating_tasks
Hello from Task BHello from Task A
Hello from Task AHello from Task B
Hello from Task A
Hello from Task B
Hello from Task A
Hello from Task B
Hello from Task AHello from Task B
[2014-09-05 21:17:14] process terminated successfully, elapsed time: 00.68s
If the program runs again the result is again different.
The order of the tasks executing is random and that is ok but why is it changing and why is the New_Line zapped?
Using gnat 2014 on MacOS 10.9
Thanks
Laurent
next reply other threads:[~2014-09-05 19:30 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-05 19:30 Laurent [this message]
2014-09-05 19:47 ` Strange behavior sbelmont700
2014-09-05 20:05 ` Laurent
2014-09-06 0:53 ` Dennis Lee Bieber
2014-09-06 1:35 ` Adam Beneschan
2014-09-05 20:23 ` Jeffrey Carter
2014-09-05 20:48 ` Robert A Duff
2014-09-05 20:34 ` Robert A Duff
2014-09-05 20:40 ` Laurent
2014-09-06 1:10 ` Dennis Lee Bieber
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox