]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
(__sleep): Optimize for zero seconds.
authorUlrich Drepper <drepper@redhat.com>
Thu, 14 Oct 1999 19:21:37 +0000 (19:21 +0000)
committerUlrich Drepper <drepper@redhat.com>
Thu, 14 Oct 1999 19:21:37 +0000 (19:21 +0000)
sysdeps/unix/sysv/linux/sleep.c

index 5fb11603cff08ab60dce6c90bdefeb420a05efd8..163f574da1bbd045549d372a9b196f7507a9635f 100644 (file)
@@ -1,5 +1,5 @@
 /* Implementation of the POSIX sleep function using nanosleep.
-   Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
@@ -34,6 +34,10 @@ __sleep (unsigned int seconds)
   struct sigaction oact;
   unsigned int result;
 
+  /* This is not necessary but some buggy programs depend on this.  */
+  if (seconds == 0)
+    return 0;
+
   /* Linux will wake up the system call, nanosleep, when SIGCHLD
      arrives even if SIGCHLD is ignored.  We have to deal with it
      in libc.  We block SIGCHLD first.  */