enhance hello2
authorPierre-Marc Fournier <pierre-marc.fournier@polymtl.ca>
Fri, 26 Jun 2009 02:36:27 +0000 (22:36 -0400)
committerPierre-Marc Fournier <pierre-marc.fournier@polymtl.ca>
Fri, 26 Jun 2009 02:36:27 +0000 (22:36 -0400)
tests/hello2/hello2.c

index 836df53c7acb4d899c14954b3b151ba485d88e89..5e7383e5fa5dbbd9789e4c1400c70f752f6608c8 100644 (file)
@@ -1,18 +1,27 @@
 #include <stdio.h>
-#include <unistd.h>
+#include <time.h>
+#include <errno.h>
+
 #include "marker.h"
 int main()
 {
        int i;
+       struct timespec tv;
+       struct timespec rem;
+       int result;
+
+       tv.tv_sec = 1;
+       tv.tv_nsec = 0;
 
-//     sleep(1);
+       do {
+               result = nanosleep(&tv, &tv);
+       } while(result == -1 && errno == EINTR);
 
        printf("Hello, World!\n");
 
        for(i=0; i<500; i++) {
                trace_mark(ust, bar, "str %d", i);
                trace_mark(ust, bar2, "number1 %d number2 %d", (int)53, (int)9800);
-               usleep(20);
        }
 
        return 0;
This page took 0.024837 seconds and 4 git commands to generate.