unix - Sleep() returns early in xcode -


If I run the code in xodod, then return to sleep when the child process goes out in just 1 second; But when I run this code in the terminal and it will sleep 10 seconds, why ??

  int main (int argc, const char * argv []) {pid_t pid; If ((pid = fork ()) == 0) {sleep (1); } And {sleep (10); Printf ("hello"); } Return 0; } 

OK if you check the return code from sleep, you will see it return to -1 is checking the error at and EINTR .

If you need to use, please work on this issue to see the answer I answered.


Comments

Popular posts from this blog

c++ - C/pp Sockets, recv()/send() works only under gdb -

GO: Serve static pages -

objective c - How to open front/back camera at the same time in iOS developing? -