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.1 required=5.0 tests=BAYES_00, PP_MIME_FAKE_ASCII_TEXT autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,c96afc4bd5bda0f0 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news1.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local1.nntp.dca.giganews.com!nntp.megapath.net!news.megapath.net.POSTED!not-for-mail NNTP-Posting-Date: Mon, 17 Jan 2005 16:02:43 -0600 From: "Randy Brukardt" Newsgroups: comp.lang.ada References: Subject: Re: Gnat 3.4.2 tasking errorcodes windows Date: Mon, 17 Jan 2005 16:04:32 -0600 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 Message-ID: NNTP-Posting-Host: 64.32.209.38 X-Trace: sv3-ivRU25iSJ6J5ZDDzvfTvGxTk6JvbcoYYiLE/Ku5Y3ASgfiZBdebePPFzVrKKZtPqwzRFqjlz/z+tB9Y!tfqHM7PdceRfT7ze4lDV5EFXJeidFTgmbWnSJu736DW7uSsViTbJB9PGe3wSBvmdVeZS2aQf2HyH X-Complaints-To: abuse@megapath.net X-DMCA-Complaints-To: abuse@megapath.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.22 Xref: g2news1.google.com comp.lang.ada:7882 Date: 2005-01-17T16:04:32-06:00 List-Id: "Bj�rn Lundin" wrote in message news:mailman.65.1105991123.527.comp.lang.ada@ada-france.org... ... > What I wonder is why I can get the correct errorcode by calling > WSAGetLasterror (which is what Gnat.Sockets.Thin.Socket Errno does, just > pragma import) when having no tasks, but not when having tasks. I wouldn't expect that to work. WSAGetLastError isn't necessarily thread-safe: I believe that there is only one global copy per process. If you have multiple threads all doing sockets calls, the values will get clobbered by the next sockets call. We handled that in the Claw sockets bindings by grabbing the WSAGetLastError value immediately, and then raising an appropriate exception (but even that isn't guaranteed to work in every case). Waiting certainly won't work. I would guess that the reason that Gnat.Sockets.Thin directly accesses via Import is that it assumes no tasking issues. In any case, why access this directly? You're just asking for trouble, by making yourself rediscover things that the binding writers already did. Randy.