public inbox for pthreads-win32@sourceware.org
 help / color / mirror / Atom feed
* Winsock dependency.
@ 2009-10-19 15:10 Ramiro Polla
  2009-10-19 20:14 ` Phil Frisbie, Jr.
  0 siblings, 1 reply; 2+ messages in thread
From: Ramiro Polla @ 2009-10-19 15:10 UTC (permalink / raw)
  To: pthreads-win32

Hi,

A dependency to Winsock was introduced to pthreads-win32 in this commit:
2001-08-23  Phil Frisbie, Jr. <phil at hawksoft.com>

        * tsd.c (pthread_getspecific): Preserve the last
        winsock error [from WSAGetLastError()].

There was an unanswered reply that questions whether this was really necessary:
http://sourceware.org/ml/pthreads-win32/2001/msg00122.html

Does anyone have a reproducible testcase that triggers the error this
commit was supposed to fix?

I've tested on win98, xp and vista and I can't get GetTlsValue() to
touch WSA errors. The source code in Wine also only uses
SetLastError(), and not WSASetLastError().

If I understood correctly, this should only be a problem if the user does:
some_wsock_function()
some_pthread_function()
WSAGetLastError()

In the case where people check for errors right after calling a wsock
function this shouldn't be a problem, right?

Ramiro Polla

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Winsock dependency.
  2009-10-19 15:10 Winsock dependency Ramiro Polla
@ 2009-10-19 20:14 ` Phil Frisbie, Jr.
  0 siblings, 0 replies; 2+ messages in thread
From: Phil Frisbie, Jr. @ 2009-10-19 20:14 UTC (permalink / raw)
  To: Ramiro Polla; +Cc: pthreads-win32

Hello Ramiro,

Perhaps I had a poorly written LSP installed on my NT 4.0 system I used
back in 2001, but I assure you it was a problem!  The call to TlsGetValue
would reset the value retrieved from WSAGetLastError, and simply saving
and then setting the value of GetLastError would not suffice.

Also, while the WIN32/64 documentation seems to say WSAGetLastError is an
alias for GetLastError, the CE documentation does not.

In my own library I coded around the problem by saving and resetting the
value of WSAGetLastError while calling pthread_getspecific, so feel free
to remove it and hope nobody else sees the problem!


On Mon, October 19, 2009 8:09 am, Ramiro Polla wrote:
> Hi,
>
> A dependency to Winsock was introduced to pthreads-win32 in this commit:
> 2001-08-23  Phil Frisbie, Jr. <phil at hawksoft.com>
>
>         * tsd.c (pthread_getspecific): Preserve the last
>         winsock error [from WSAGetLastError()].
>
> There was an unanswered reply that questions whether this was really
> necessary:
> http://sourceware.org/ml/pthreads-win32/2001/msg00122.html
>
> Does anyone have a reproducible testcase that triggers the error this
> commit was supposed to fix?
>
> I've tested on win98, xp and vista and I can't get GetTlsValue() to
> touch WSA errors. The source code in Wine also only uses
> SetLastError(), and not WSASetLastError().
>
> If I understood correctly, this should only be a problem if the user does:
> some_wsock_function()
> some_pthread_function()
> WSAGetLastError()
>
> In the case where people check for errors right after calling a wsock
> function this shouldn't be a problem, right?
>
> Ramiro Polla

-- 
Phil Frisbie, Jr.
Hawk Software
http://www.hawksoft.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-10-19 20:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-19 15:10 Winsock dependency Ramiro Polla
2009-10-19 20:14 ` Phil Frisbie, Jr.

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).