From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00,FREEMAIL_FROM, REPLYTO_WITHOUT_TO_CC,XPRIO autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d5977aa20216d24a,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-04-01 08:28:20 PST Path: supernews.google.com!sn-xit-02!supernews.com!news.tele.dk!148.122.208.68!news2.oke.nextra.no!nextra.com!news3.oke.nextra.no.POSTED!not-for-mail Reply-To: "Frank" From: "Frank" Newsgroups: comp.lang.ada Subject: Ada Tasks vs Linux processes X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2615.200 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200 Message-ID: <2OHx6.4154$NR.335287@news3.oke.nextra.no> Date: Sun, 1 Apr 2001 17:27:47 +0200 NNTP-Posting-Host: 130.67.134.200 X-Complaints-To: news-abuse@nextra.no X-Trace: news3.oke.nextra.no 986138878 130.67.134.200 (Sun, 01 Apr 2001 17:27:58 MEST) NNTP-Posting-Date: Sun, 01 Apr 2001 17:27:58 MEST Organization: Nextra Public Access Xref: supernews.google.com comp.lang.ada:6314 Date: 2001-04-01T17:27:47+02:00 List-Id: 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; -------