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.
#include <stdio.h> #include <string.h> #include <sys/types.h> #include <sys/time.h> #include <unistd.h> 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); }