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=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,XPRIO autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,b8705ab189212b9e,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-04-06 10:37:29 PST Path: supernews.google.com!sn-xit-02!supernews.com!isdnet!grolier!newsfeeds.belnet.be!news.belnet.be!afrodite.telenet-ops.be!not-for-mail From: "Pieter Thysebaert" Newsgroups: comp.lang.ada Subject: (Newbie) intertask communication X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Message-ID: Date: Fri, 06 Apr 2001 17:37:26 GMT NNTP-Posting-Host: 213.224.138.160 X-Complaints-To: abuse@pandora.be X-Trace: afrodite.telenet-ops.be 986578646 213.224.138.160 (Fri, 06 Apr 2001 19:37:26 MET DST) NNTP-Posting-Date: Fri, 06 Apr 2001 19:37:26 MET DST Organization: Telenet Internet Xref: supernews.google.com comp.lang.ada:6581 Date: 2001-04-06T17:37:26+00:00 List-Id: Hi.... I'm trying to have two tasks interact (using entry/accept). In fact we have this assignment where we are supposed to (not in reality) monitor some patient's heartbeat. So I created two task types : patient and monitor The idea is that the patient will call the function (entry) beat on his/her associated monitor; the monitor will accept beat() calls and will display a warning when not receiving a heartbeat for two (or x) seconds So this is my monitor: task body monitortask is id : Integer; begin accept start(patient_id : Integer) do id := patient_id; end; loop select accept beat do PutLine(); end; or delay 2; sound_alarm(); end loop; end monitortask; And the patient : task body patienttask is begin accept start(m : monitortask) do loop delay ; m.beat; end loop; end; end patienttask; My problem/question is : this stuff only works when m.start is called first in a testprogram, end then p.start (m : monitortask and p : patientask) - the testprogram blosk on the patient.start thing That's because I have the loop _IN_ the patient's accept statement. Of course what I want is more like : task body patienttask is mymonitor : monitortask; begin accept start(m : monitortask) do mymonitor := m; end; loop .....do stuff but call mymonitor.beat; which will not block the testprogram calling p.start; Unfortunately, the assignment to mymonitor does not work like this. How would I pass the "name" of a task to antoher task to have it use that one ? And how can I save a "reference"to a task ? Pieter