X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,TW_FD X-Spam-Check-By: sourceware.org From: "Bert Belder" To: Subject: Re: python select() is limited to fds < 64 Date: Wed, 20 Apr 2011 18:50:40 +0200 Message-ID: <000001cbff7b$155e6840$401b38c0$@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: 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 Christopher Faylor wrote: > I forgot to add one bit of data. Unless you go out of your way to > change it, Cygwin's select can't wait for an fd > 63. It's basically a > bit mask. So, there are two limitations: 1) the number of handles that > you can wait for with WaitForMultipleObjects() and 2) the size of > Cygwin's fd_set. I have trouble believing this for two reasons: 1. I use node.js on Cygwin, and there seem to be no problems waiting for readiness of a large (>1000) number of sockets. By default node uses poll() which calls cygwin_select under the hood, but even when I force it to use select() directly everything works ok. 2. Inspecting src/winsup/cygwin/select.cc, it looks like Cygwin distributes the sockets (and other selectable stuff) that it is interested in over different threads and uses WaitForMultipleObjects in those threads. Then in the main thread it uses another WaiForMultipleObjects call to synchronize between those threads. As different interests (read/write/error) and different fd types require their own thread the fd limit must be somewhere between a few hundred and 4032 (=64*63). What did I miss? Thanks, Bert -- 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