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, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,126ce244c524526b X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!feeder3.cambrium.nl!feeder1.cambrium.nl!feed.tweaknews.nl!amsnews11.chello.com!newsfeed01.chello.at!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Tasking issues Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <1186851804.567302.223160@q4g2000prc.googlegroups.com> <1186938729.414350.288620@d55g2000hsg.googlegroups.com> Date: Sun, 12 Aug 2007 20:03:32 +0200 Message-ID: NNTP-Posting-Date: 12 Aug 2007 20:03:24 CEST NNTP-Posting-Host: 27b75453.newsspool1.arcor-online.net X-Trace: DXC=eIkWQ4Fo<]lROoR14nDHegD_]R534Q6J8mdIl7DNcfSJ;bb[5IRnRBaCdcAEZhN`K\M0BdQ_M>fBSc< X-Complaints-To: usenet-abuse@arcor.de Xref: g2news2.google.com comp.lang.ada:1412 Date: 2007-08-12T20:03:24+02:00 List-Id: On Sun, 12 Aug 2007 10:12:09 -0700, shaunpatterson@gmail.com wrote: > I just wanted the two threads to run quitely in the > background. > > However, one thread is reading from sockets... > and that thread is preventing the other task from running. Reading from socket does not block anything, provided that the tasks are mapped to native threads. > I'd have to check, but I was SURE I set the GNAT Sockets to > non-blocking... which (I assume) would allow the other thread > to run. You should check that tasks are mapped to OS threads. AFAIK, this is the default when you are using GNAT. If not, then all tasks are scheduled by Ada RTL from one system thread and consequently I/O would block all of them. See http://gcc.gnu.org/onlinedocs/gcc-3.4.6/gnat_ugn_unw/Choosing-between-Native-and-FSU-Threads-Libraries.html With native threads you can safely do blocking socket I/O without any problems. Otherwise, you should use only asynchronous I/O. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de