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,7bc6024195cd0b25,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-06-19 13:04:44 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!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: Simple Producer/Consumer with Annex E 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: NNTP-Posting-Host: 130.67.134.246 X-Complaints-To: news-abuse@nextra.no NNTP-Posting-Date: Tue, 19 Jun 2001 22:01:54 MEST Organization: Nextra Public Access X-Trace: news3.oke.nextra.no 992980915 130.67.134.246 Date: Tue, 19 Jun 2001 22:00:55 +0200 Xref: archiver1.google.com comp.lang.ada:8894 Date: 2001-06-19T22:00:55+02:00 List-Id: Hi! I'm trying to create two "main" like procedures, one in each partition. These two procedures shall communicate with a task in a package placed in a third partition. In a third partition I place a package that contains a task (called SERVER). This server initialize a buffer variable CURRENT_VALUE to 1000. One of the procedures (P_SENDER) shall send two values to the server, and change the CURRENT_VALUE. The other procedure (P_RECEIVER) shall get the CURRENT_VALUE in the task. The receiver has a loop that prints the value it get from the server, this in order to see the progress. As the code is now, I start the server (executable get the name: PART_SERVER) first, and then I start the receiver (executable get the name: PART_RECEIVER). The receiver starts printing 1000...1000... Then I start the sender (executable get the name: PART_SENDER). What I experience is that only the first of the values (123) I wish to send is received at the receiver, and the next value is never passed. In the configuration file; I have established the P_RECEIVER procedure as the applications main procedure (which is placed in PART_RECEIVER), then I have established P_SENDER as a 'Main for partition PART_SENDER. I have done some experiments with this code, and have a hunch that it is the sender that for some reason dosn't send the next value. I wonder if this is caused by the "for PART_SENDER'Main use P_SENDER" construction, that might not work as a believe? I believed that the 'Main construction would give me another "main", in the sense that if I switched the roles of the to (P_RECEIVER and P_SENDER) that should give me the same functionality. Is this nonsense? I have also considered the 'Task_Pool setting, but haven't quite succeded in setting it. Does the compiler use some default values that gives me this situation? Does anyone have any suggestions? (Makefile, P_SENDER, P_RECEIVER and PA_SERVER is added to this posting) Frank ----------------------------------------- configuration SENDER_SERVER_RECEIVER is PART_RECEIVER : Partition := (P_RECEIVER); for PART_RECEIVER'Host use "localhost"; procedure P_RECEIVER is in PART_RECEIVER; PART_SENDER : Partition := (P_SENDER); for PART_SENDER'Host use "localhost"; procedure P_SENDER; for PART_SENDER'Main use P_SENDER; PART_SERVER : Partition := (PA_SERVER); for PART_SERVER'Host use "localhost"; pragma Starter (None); end SENDER_SERVER_RECEIVER; ----------------------------------------- with PA_SERVER; with TEXT_IO; procedure P_SENDER is begin PA_SERVER.SEND (123); PA_SERVER.SEND (124); end P_SENDER; ----------------------------------------- with PA_SERVER; with TEXT_IO; procedure P_RECEIVER is RECEIVED : INTEGER; begin PA_SERVER.START_SERVER; TEXT_IO.PUT_LINE ("Server has been started"); loop PA_SERVER.RECEIVE (RECEIVED); TEXT_IO.PUT_LINE ("Received = " & RECEIVED'Img); end loop; end P_RECEIVER; ----------------------------------------- with TEXT_IO; package body PA_SERVER is task type TYPE_TASK_SERVER is entry START_SERVER; entry RECEIVE ( P_RECEIVE : out INTEGER); entry SEND ( P_SEND : in INTEGER); end TYPE_TASK_SERVER; task body TYPE_TASK_SERVER is RUNNING : BOOLEAN := FALSE; CURRENT_VALUE : INTEGER; begin CURRENT_VALUE := 1000; accept START_SERVER do RUNNING := TRUE; end START_SERVER; while RUNNING loop select accept RECEIVE (P_RECEIVE : out INTEGER) do P_RECEIVE := CURRENT_VALUE; end RECEIVE; or accept SEND (P_SEND : in INTEGER) do CURRENT_VALUE := P_SEND; end SEND; end select; end loop; end TYPE_TASK_SERVER; SERVER : TYPE_TASK_SERVER; procedure RECEIVE (P_RECEIVE : out INTEGER) is begin SERVER.RECEIVE (P_RECEIVE); end RECEIVE; procedure SEND (P_SEND : in INTEGER) is begin SERVER.SEND (P_SEND); end SEND; procedure START_SERVER is begin SERVER.START_SERVER; end START_SERVER; end PA_SERVER; ------------------------------------- package PA_SERVER is pragma Remote_Call_Interface; procedure RECEIVE (P_RECEIVE : out INTEGER); procedure SEND (P_SEND : in INTEGER); procedure START_SERVER; end PA_SERVER; ------------------------------------- Makefile all: gnatdist -v sender_server_receiver.cfg `gtkada-config` clean: rm -rf *.o *.ali dsa