From: "Frank" <franjoe@frisurf.no>
Subject: Ada Tasks vs Linux processes
Date: Sun, 1 Apr 2001 17:27:47 +0200
Date: 2001-04-01T17:27:47+02:00 [thread overview]
Message-ID: <2OHx6.4154$NR.335287@news3.oke.nextra.no> (raw)
Hi!
I have made a package with a task type, I instanciate this task "as a
variable" in a test program.
It compiles ok.
When I perform "ps -ef" while this program runs, I find three processes
named "mytest".
I have preconceived idea :-) that I should have only two processes. Have I
done something in my code that causes this behaviour, or is this the way it
is?
I'm using the "select ..or ..or delay n" statement below, and I have choosen
to use "delay 0.0" to make the process continue with the business logic
below without any waiting for any rendezvous. Does delay 0.0 have a
predefined behaviour?
Source code supplied below
Frank
-----------
package PA_TEST is
task type TTSK_TEST is
entry INIT;
entry DO_STUFF;
entry DIE;
end;
end PA_TEST;
---------
with TEXT_IO;
package body PA_TEST is
task body TTSK_TEST
is
RUNNING : BOOLEAN := FALSE;
begin
accept INIT do
TEXT_IO.PUT_LINE ("TTSK_TEST.INIT");
RUNNING := TRUE;
end INIT;
while RUNNING loop
select
accept DO_STUFF do
TEXT_IO.PUT_LINE ("TTSK_TEST.DO_STUFF");
end DO_STUFF;
or
accept DIE do
TEXT_IO.PUT_LINE("TTSK_TEST.DIE");
RUNNING := FALSE;
end DIE;
or
delay 0.0; -- In order to "fall through" select statement.
end select;
-- Business logic
-- ----"--------
-- ----"--------
end loop;
TEXT_IO.PUT_LINE("PA_TEST(Terminates)");
end;
begin
TEXT_IO.PUT_LINE("PA_TEST(MAIN)");
end PA_TEST;
---------
with PA_TEST, TEXT_IO;
procedure MYTEST is
A_TASK : PA_TEST.TTSK_TEST;
WAIT : STRING(1..1);
begin
TEXT_IO.PUT_LINE("TEST");
A_TASK.INIT;
TEXT_IO.PUT_LINE ("Enter a character and press ENTER, please");
TEXT_IO.GET(WAIT);
A_TASK.DIE;
end MYTEST;
-------
next reply other threads:[~2001-04-01 15:27 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-04-01 15:27 Frank [this message]
2001-04-01 22:32 ` Ada Tasks vs Linux processes David C. Hoos, Sr.
2001-04-02 17:30 ` tmoran
2001-04-02 18:00 ` Robert A Duff
2001-04-02 18:20 ` Ehud Lamm
2001-04-02 22:17 ` Jeffrey Carter
2001-04-04 16:36 ` tmoran
2001-04-04 17:18 ` Gary Scott
2001-04-04 19:18 ` tmoran
2001-04-02 19:57 ` Frank
2001-04-03 11:28 ` Matthias Kretschmer
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox