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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,3abdc4d72c0b7e9d,start X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!postnews.google.com!z24g2000prf.googlegroups.com!not-for-mail From: Bender Newsgroups: comp.lang.ada Subject: Running a background task Date: Thu, 15 May 2008 13:51:58 -0700 (PDT) Organization: http://groups.google.com Message-ID: NNTP-Posting-Host: 130.76.64.93 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1210884719 12171 127.0.0.1 (15 May 2008 20:51:59 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 15 May 2008 20:51:59 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: z24g2000prf.googlegroups.com; posting-host=130.76.64.93; posting-account=znprRwoAAABc0sBerLGAFs7TqvGvhALp User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 (CK-zz) Firefox/2.0.0.6,gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:81 Date: 2008-05-15T13:51:58-07:00 List-Id: Hi, I'm pretty new to Ada, and need to figure out a way to kick off a background task that runs more or less forever, while normal execution of the program continues. Thus far I've figured out how to create a task and start it, but the procedure calling it requires the task to finish before continuing on. I'm sure I just must be using the wrong mechanisms, but I can't really figure out the answer. Task definition --------------------- (spec) task type Poll_For_Status is entry On_String (String : in SideAB) end Poll_For_Status; type Task_Access is access Poll_For_Status; Status_Task : Task_Access; (body) task body Poll_For_Status is begin accept On_String (String : in SideAB) do loop delay 3.0 Send_Status_Req (String); end loop; end On_String; end Poll_For_Status; Calling procedure ------------------------ procedure Handle_Msg(...) is String : SideAB; ... begin ... Status_Task := new Poll_For_Status Status_Task.On_String (String); ... If I remove the loop in the task body, it works fine. Putting it in seems to halt execution. Am I missing anything?