delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/10/31/06:17:11

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Date: Fri, 31 Oct 2003 12:16:57 +0100
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: "cygwin AT cygwin DOT com" <cygwin AT cygwin DOT com>
Subject: Re: select() take 100% CPU with cygwin1.5.5-1 in WinXP/Win2000
Message-ID: <20031031111657.GA3918@cygbert.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: "cygwin AT cygwin DOT com" <cygwin AT cygwin DOT com>
References: <200310310514 DOT h9V5EMM04538 AT mx1 DOT redhat DOT com>
Mime-Version: 1.0
In-Reply-To: <200310310514.h9V5EMM04538@mx1.redhat.com>
User-Agent: Mutt/1.4.1i

On Fri, Oct 31, 2003 at 01:14:17PM +0800, zhouxin wrote:
> Cygwin implementation of select() take 100% CPU under multi-thread environment sometimes.
> [...]
>     if((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0){
>         fprintf(stderr, "cannot open socket for udp packet!\n");
>         exit(1);
>     }
>         
>     while(1){
>         struct timeval    tv;
>         fd_set            fds;
>         
>         FD_ZERO(&fds);
>         FD_SET(sockfd, &fds);
>         
>         tv.tv_sec  =  timeout;
>         tv.tv_usec = 0;
>         printf("select the socket_fd : %d, thread_id is : %d\n", 
>                 sockfd, tid);
>         select(sockfd + 1, &fds, NULL, NULL, &tv);
>     }

That's not allowed.  What is the select call waiting for?  You
didn't bind or connect it.

Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                                mailto:cygwin AT cygwin DOT com
Red Hat, Inc.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019