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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,c22949b5ebf3505f X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-05-11 11:01:50 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!bloom-beacon.mit.edu!cambridge1-snf1.gtei.net!news.gtei.net!bos-service1.ext.raytheon.com!cyclone.swbell.net!newsfeed1.easynews.com!easynews.com!easynews!border3.nntp.aus1.giganews.com!nntp.giganews.com!wn14feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi.com!rwcrnsc51.ops.asp.att.net.POSTED!not-for-mail From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: [OT] Two sockets questions References: <874r428pcb.fsf@inf.enst.fr> X-Newsreader: Tom's custom newsreader Message-ID: NNTP-Posting-Host: 12.234.13.56 X-Complaints-To: abuse@attbi.com X-Trace: rwcrnsc51.ops.asp.att.net 1052676109 12.234.13.56 (Sun, 11 May 2003 18:01:49 GMT) NNTP-Posting-Date: Sun, 11 May 2003 18:01:49 GMT Organization: AT&T Broadband Date: Sun, 11 May 2003 18:01:49 GMT Xref: archiver1.google.com comp.lang.ada:37186 Date: 2003-05-11T18:01:49+00:00 List-Id: > Tom> It's intended for blocking sockets, so it sits around and polls > Tom> till the select says its writable, or some other error is > Tom> returned. It actually opens as non-blocking so it can get > Tom> control back from the OS to do this polling, and timeout > Tom> checking, etc. > > Why not make the socket blocking in this case (around connect()) since > your code sits and waits for select() to return? Three reasons: The Open procedure has a timeout parameter, so it needs to be able to terminate the "connect" early. The package also has a "Request_Quit" mechanism whereby some task can ask another to abort a wait on socket activity. It's simpler and clearer to check with a direct poll loop (with "delay") than with Windows' message loop polling. Also, one of the targeted compilers does its own tasking within a single Windows thread, so a true block of the thread would block all tasks. (That compiler's Ada task switch time, not going through the OS, is quite a bit faster. It also can target Windows 3.1, though I grant that may no longer be very important.)