From owner-freebsd-current Thu Jul 26 2:22:58 2001 Delivered-To: freebsd-current@freebsd.org Received: from vega.vega.com (dialup2-22.iptelecom.net.ua [212.9.226.86]) by hub.freebsd.org (Postfix) with ESMTP id E36FD37B406; Thu, 26 Jul 2001 02:22:45 -0700 (PDT) (envelope-from sobomax@FreeBSD.org) Received: from FreeBSD.org (big_brother.vega.com [192.168.1.1]) by vega.vega.com (8.11.4/8.11.3) with ESMTP id f6PBBbD75699; Wed, 25 Jul 2001 14:11:37 +0300 (EEST) (envelope-from sobomax@FreeBSD.org) Message-ID: <3B5EA985.458B39B7@FreeBSD.org> Date: Wed, 25 Jul 2001 14:12:06 +0300 From: Maxim Sobolev Organization: Vega International Capital X-Mailer: Mozilla 4.77 [en] (Windows NT 5.0; U) X-Accept-Language: en,uk,ru MIME-Version: 1.0 To: current@FreeBSD.org Cc: Julian Elischer , stable@FreeBSD.org Subject: Strange select(2) misbehaviour when linked with -pthread Content-Type: multipart/mixed; boundary="------------45E7A6BD8D2F3ADC6B9063B1" Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG This is a multi-part message in MIME format. --------------45E7A6BD8D2F3ADC6B9063B1 Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: 7bit Hi, I found that the attached small program behaves very strangely when linked with -pthread - it chews 100% CPU cycles while waiting in select(2). This misbehaviour observed both on 5-CURRENT and 4-STABLE systems. *weird* -Maxim P.S. And yes, I know that I ought to use NULL instead of &tv when I want to wait indefinitely in select(2), but it is how some programs work. --------------45E7A6BD8D2F3ADC6B9063B1 Content-Type: text/plain; charset=koi8-r; name="selectbug.c" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="selectbug.c" #include #include #include #include #include int main() { int retval, fd; u_int32_t timeout; struct timeval tv; fd_set mask; fd = 0; timeout = ~0; tv.tv_sec = timeout/1000; tv.tv_usec = (timeout%1000)*1000; FD_ZERO(&mask); FD_SET(fd, &mask); retval = select(1, &mask, NULL, NULL, &tv); exit(0); } --------------45E7A6BD8D2F3ADC6B9063B1-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message