From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17304 invoked by alias); 19 Oct 2009 20:14:12 -0000 Received: (qmail 17295 invoked by uid 22791); 19 Oct 2009 20:14:11 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from b.mail.sonic.net (HELO b.mail.sonic.net) (64.142.19.5) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 19 Oct 2009 20:14:06 +0000 Received: from webmail.sonic.net (b.webmail.sonic.net [64.142.100.148]) by b.mail.sonic.net (8.13.8.Beta0-Sonic/8.13.7) with ESMTP id n9JKE464016267; Mon, 19 Oct 2009 13:14:04 -0700 Received: from 149.136.33.253 (SquirrelMail authenticated user philf) by webmail.sonic.net with HTTP; Mon, 19 Oct 2009 13:14:04 -0700 Message-ID: <9c971600b340f71c880ff92719f60575.squirrel@webmail.sonic.net> In-Reply-To: References: Date: Mon, 19 Oct 2009 20:14:00 -0000 Subject: Re: Winsock dependency. From: "Phil Frisbie, Jr." To: "Ramiro Polla" Cc: pthreads-win32@sourceware.org User-Agent: SquirrelMail/1.4.19 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes Mailing-List: contact pthreads-win32-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: pthreads-win32-owner@sourceware.org X-SW-Source: 2009/txt/msg00054.txt.bz2 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. > > * 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