Divy Kanungo writes: > I have following piece of code that ran fine with gcc 3.x > > req.tv_sec = 5; > req.tv_nsec = 10000000; //100ms > do{ > rc = nanosleep(&req, &rem); > } while(rem.tv_sec != 0 || rem.tv_nsec !=0); > > After upgrade to gcc 4.1.1 the above code goes to infinite loop. > is this a bug in gcc 4.x ? How do I resolve this? Read the nanosleep man page. You need something like if (rc == -1) req = rem; Andrew.