comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Gnat 3.4.2 tasking errorcodes windows
Date: Mon, 17 Jan 2005 16:04:32 -0600
Date: 2005-01-17T16:04:32-06:00	[thread overview]
Message-ID: <kKadnf42BKeeq3HcRVn-hQ@megapath.net> (raw)
In-Reply-To: mailman.65.1105991123.527.comp.lang.ada@ada-france.org

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1102 bytes --]

"Bj�rn Lundin" <bnl@tiscali.se> 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.









  reply	other threads:[~2005-01-17 22:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-17 19:44 Gnat 3.4.2 tasking errorcodes windows Björn Lundin
2005-01-17 22:04 ` Randy Brukardt [this message]
2005-01-17 23:17   ` tmoran
2005-01-18 18:52   ` Björn Lundin
     [not found]   ` <200501181952.49091.bnl@tiscali.se>
2005-01-18 21:26     ` Stephen Leake
2005-01-18  0:33 ` Jeff C
2005-01-18 18:55   ` Björn Lundin
2005-01-18 14:44 ` Craig Carey
2005-01-18 16:34   ` Nicolas
2005-01-18 18:54     ` Björn Lundin
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox