select() take 100% CPU with cygwin1.5.5-1 in WinXP/Win2000
Corinna Vinschen
corinna-cygwin@cygwin.com
Fri Oct 31 12:38:00 GMT 2003
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@cygwin.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/
More information about the Cygwin
mailing list