gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r4920 - GNUnet/src/util/os


From: gnunet
Subject: [GNUnet-SVN] r4920 - GNUnet/src/util/os
Date: Sun, 3 Jun 2007 20:51:59 -0600 (MDT)

Author: grothoff
Date: 2007-06-03 20:51:59 -0600 (Sun, 03 Jun 2007)
New Revision: 4920

Modified:
   GNUnet/src/util/os/semaphoretest.c
Log:
fixing testcase

Modified: GNUnet/src/util/os/semaphoretest.c
===================================================================
--- GNUnet/src/util/os/semaphoretest.c  2007-06-04 02:31:35 UTC (rev 4919)
+++ GNUnet/src/util/os/semaphoretest.c  2007-06-04 02:51:59 UTC (rev 4920)
@@ -57,7 +57,7 @@
        IPC_SEMAPHORE_DOWN(ipc,
                           YES);
        fd = FOPEN("/tmp/gnunet_ipc_xchange",
-                      "a+");
+                  "a+");
        if (fd == NULL) {
          printf("Could not open testfile for reading: %s\n",
                 STRERROR(errno));
@@ -66,8 +66,6 @@
        }
        fseek(fd, 4*i, SEEK_SET);
        si = GN_FREAD(&j, 4, 1, fd);
-       while (si == 0)
-         si = GN_FREAD(&j, 4, 1, fd);
        if (si != 1) {
          printf("Could not read from testfile: %d - %s at %s:%d\n",
                 si,
@@ -90,9 +88,9 @@
       sw = 1;
     } else {
       for (i=0;i<6;i++) {
-       sleep(1);
+       PTHREAD_SLEEP(50 + i*50);
        fd = FOPEN("/tmp/gnunet_ipc_xchange",
-                      "w+");
+                  "a+");
        if (fd == NULL) {
          printf("Could not open testfile for writing: %s\n",
                 STRERROR(errno));
@@ -111,7 +109,7 @@
        IPC_SEMAPHORE_UP(ipc);
       }
       fprintf(stderr, ".");
-      sleep(2); /* give reader ample time to finish */
+      sleep(1); /* give reader ample time to finish */
       sw = 0;
     }
   }
@@ -121,12 +119,14 @@
   if (me == 0) {
     exit(ret);
   } else {
-    GE_LOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
-       " waiting for other process to exit.\n");
+    GE_LOG(ectx, 
+          GE_DEBUG | GE_REQUEST | GE_USER,
+          "waiting for other process to exit.\n");
     if (-1 == waitpid(me, &j, 0))
-      GE_LOG(ectx, GE_ERROR | GE_BULK | GE_USER,
-         " waitpid failed: %s\n",
-         STRERROR(errno));
+      GE_LOG(ectx,
+            GE_ERROR | GE_BULK | GE_USER,
+            "waitpid failed: %s\n",
+            STRERROR(errno));
     if ((! WIFEXITED(j)) || WEXITSTATUS(j) == 1)
       ret = 1; /* error in child */
   }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]