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>
#include <stdio.h>
#include <string.h>
#include <pthread.h>
-#include <unistd.h>
+#include <time.h>
static void *
test_thread (void *v_param)
main (void)
{
unsigned long count;
+ struct timespec ts;
+ ts.tv_sec = 0;
+ ts.tv_nsec = 10 * 1000;
setvbuf (stdout, NULL, _IONBF, 0);
}
/* pthread_detach (thread); */
pthread_join (thread, NULL);
- usleep (10);
+ nanosleep (&ts, NULL);
}
return 0;
}
#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 {
main (void)
{
unsigned long count;
+ struct timespec ts;
+ ts.tv_sec = 0;
+ ts.tv_nsec = 10 * 1000;
setvbuf (stdout, NULL, _IONBF, 0);
printf ("count = %lu\n", count);
}
- usleep (10);
+ nanosleep (&ts, NULL);
}
return 0;