"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.