X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Date: Mon, 18 Apr 2011 14:01:59 +0200 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: listen socket / poll block Message-ID: <20110418120159.GF25815@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com On Apr 6 18:19, Thomas Stalder wrote: > Hello, > > I made a small application that block poll function. > > the result is : > > before pthread_create > after pthread_create > before poll > before shutdown socket > after shutdown socket > before close socket > after close socket > > > under linux the result is: > > before pthread_create > after pthread_create > before poll > before shutdown socket > after shutdown socket > after poll ret=1 > error accept failed: Invalid argument First of all, thanks for the testcase. It turns out that the semantics of Winsock's shutdown function are different from the Linux implementation. Not overly surprising, but it makes trying to get the behaviour working the same way as on Linux a bit awkward. The problem is that in your scenario the shutdown function works fine on Linux, and the subsequent call to accept fails because the socket has been shutdown for reading. On Winsock, the shutdown function *fails*, the error code is "socket not connected". Thus, even if Cygwin fakes the results for shutdown to trigger the poll call, the accept call does *not* fail. I applied a fix which enforces the Linux behaviour. Please give the next developer snapshot from http://cygwin.com/snapshots/ a try. Thanks, Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple