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,126ce244c524526b,start X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!q4g2000prc.googlegroups.com!not-for-mail From: shaunpatterson@gmail.com Newsgroups: comp.lang.ada Subject: Tasking issues Date: Sat, 11 Aug 2007 10:03:24 -0700 Organization: http://groups.google.com Message-ID: <1186851804.567302.223160@q4g2000prc.googlegroups.com> NNTP-Posting-Host: 155.219.241.10 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1186851805 7241 127.0.0.1 (11 Aug 2007 17:03:25 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sat, 11 Aug 2007 17:03:25 +0000 (UTC) User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727; InfoPath.1; .NET CLR 3.0.04506.30; .NET CLR 1.1.4322),gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: q4g2000prc.googlegroups.com; posting-host=155.219.241.10; posting-account=ps2QrAMAAAA6_jCuRt2JEIpn5Otqf_w0 Xref: g2news2.google.com comp.lang.ada:1400 Date: 2007-08-11T10:03:24-07:00 List-Id: I'm having trouble with tasking in Ada. I'm used to working with pthreads in C/C++... and I'm finding tasks to be somewhat different/annoying. My basic problem is I want to have 2 threads in my program. One thread sits in the background and reads in messages, dispatches them, etc and the other thread reads off a queue and sends out messages when they are available. As an analogy, let's assume my background task just got input from the user (simulating the socket read) and the other task just printed out stuff. Something like procedure main is begin task get_name; task print_something; task body get_name is Name : String (1..25); Last : Integer; begin loop Get_Line (Name, Last); end loop; end get_name; task body print_something is begin loop Put_Line ("blah..."); end loop; end print_something; begin --- main loop; null; end loop; end main; Of course, this doesn't work as I'd expect. Is there a way to "timeout" the first get_name thread... so the OS only waits on that thread for a short period of time to allow the other threads to do their business? and then go back to the thread? Thanks -- Shaun