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.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,5d5bff08777921a2,start X-Google-Attributes: gid103376,public From: Randy Kosarik Subject: returning a value from tasking?? Date: 1996/11/30 Message-ID: <32A080A9.7BCA@access.hky.com>#1/1 X-Deja-AN: 201589583 content-type: text/plain; charset=us-ascii organization: The Access Hickory Internet Network mime-version: 1.0 reply-to: randyk@access.hky.com newsgroups: comp.lang.ada x-mailer: Mozilla 3.01 (Win95; I) Date: 1996-11-30T00:00:00+00:00 List-Id: Hi, I am having a problem getting a task to work and am running out of time this semester. I am running DEC Ada version 8.2 on a VAX. What I am trying to do is get a character within 3 seconds, if no character was inputted, I want either a null character returned or a space returned. I was told from a previous message that I would have to TASK to do this. I have TASK2 calling TASK1. TASK1 will not return a value to TASK2 unless I remove the second to last line( DO_EXIT(STATUS); ) from TASK1. When I do this though, it will not exit when 3 seconds have expired. I have been scouring through the books trying to figure this one out but, the tasking concept seems to be above my head, right now.. I keep doing trial and error. Please, I have 10 days to figure this out... Any replies would be GREATLY appreciated! -Randy --------------------------start of TASK2.ADA---------------------------------------- with text_io, task1; use text_io; procedure task2 is z : character; x : INTEGER; begin loop task1(z => z); put_line(z & " brought from task1"); exit when x > 5; x := x + 1; end loop; end task2; --------------------------end of TASK2.ADA------------------------------------------ --------------------------start of TASK1.ADA---------------------------------------- with TEXT_IO; use TEXT_IO; procedure task1 (z : in out CHARACTER) is -- pragma TIME_SLICE (1.0); type CONDITION is new INTEGER; STATUS : CONDITION; -- Z:CHARACTER; task T; task body T is begin Get(Z); end; procedure DO_EXIT(STATUS :out CONDITION; EXIT_STATUS :in CONDITION := 1); pragma INTERFACE(VMS, DO_EXIT); pragma IMPORT_VALUED_PROCEDURE(DO_EXIT, pragma IMPORT_VALUED_PROCEDURE(DO_EXIT, "SYS$EXIT", MECHANISM => (VALUE, VALUE)); begin delay 3.0; -- nothing done; DO_EXIT(STATUS); end task1; --------------------------end of TASK1.ADA-----------------------------------------