diff options
author | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2009-11-25 15:42:50 +0100 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2009-11-25 15:42:50 +0100 |
commit | 557e0c8dd7831473920ad900f5205e0d6987b2aa (patch) | |
tree | c8ccdfe02c077eb8e6fea6b869905a1117ec0a2c /test/pthread/ex7.c | |
parent | 12fde89674c46989fb5b3a76e25b7defe90c4845 (diff) |
call nanosleep directly
usleep is a SUSv3 function.
TODO: nanosleep moved from SUSv3 Timers to SUSv4 Base
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Diffstat (limited to 'test/pthread/ex7.c')
-rw-r--r-- | test/pthread/ex7.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/test/pthread/ex7.c b/test/pthread/ex7.c index 49af18d96..8eeb9a2e5 100644 --- a/test/pthread/ex7.c +++ b/test/pthread/ex7.c @@ -8,7 +8,7 @@ #include <string.h> #include <pthread.h> #include <sys/time.h> -#include <unistd.h> +#include <time.h> /* Our event variable using a condition variable contruct. */ typedef struct { @@ -63,6 +63,9 @@ int main (void) { unsigned long count; + struct timespec ts; + ts.tv_sec = 0; + ts.tv_nsec = 10 * 1000; setvbuf (stdout, NULL, _IONBF, 0); @@ -96,7 +99,7 @@ main (void) printf ("count = %lu\n", count); } - usleep (10); + nanosleep (&ts, NULL); } return 0; |