1.3.2 : Fork + Sleep = problem

Adam Stallard adam@aspen.mine.nu
Wed Jul 11 02:07:00 GMT 2001


Here's a short c program that works as expected compiled under some
other unix platforms, but not under my cygwin (1.3.2 , Win 2000)
platform.

If a call to wait() is added to the code before the sleep command, it
behaves as expected; but I shouldn't have to do that.

#include <stdio.h>
#include <unistd.h>

void main(){
  for(int a=0;a<256;a++){
    pid_t poo=fork();
    if(!poo)
      exit(0);
    sleep(1);
    printf("%d\n",a);
  }
}

This should count up to 255, pausing 1 second between each count; on my
cygwin platform it counts up to 63 with pauses, and then rushes through
the rest of the count.  Select, poll, and usleep also fail in this
situation.

--Adam Stallard




--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list