Index: /trunk/src/lib/test-eintr-bug-2.c
===================================================================
--- /trunk/src/lib/test-eintr-bug-2.c	(revision 2473)
+++ /trunk/src/lib/test-eintr-bug-2.c	(revision 2474)
@@ -8,4 +8,5 @@
 #include <sys/time.h>
 #include <sys/stat.h>
+#include <fcntl.h>
 #include <time.h>
 #include <stdio.h>
@@ -14,4 +15,5 @@
 #include <pthread.h>
 #include <signal.h>
+#include <unistd.h>
 
 
@@ -21,4 +23,6 @@
 /** The number of signals. */
 static volatile long    g_cSigs = 0;
+/** Number of signals received on threads other than the main one. */
+static volatile long    g_cSigsOther = 0;
 /** Whether to shutdown or not. */
 static volatile int     g_fShutdown = 0;
@@ -30,4 +34,6 @@
 {
     g_cSigs++;
+    if (pthread_self() != g_hMainThread)
+        g_cSigsOther++;
 
     (void)iSig;
@@ -46,11 +52,14 @@
 static void *ThreadProc(void *pvIgnored)
 {
+    int volatile i = 0;
     while (!g_fShutdown)
     {
-        NanoSleep(850);
+//        NanoSleep(850);
         if (g_fShutdown)
             break;
 
         pthread_kill(g_hMainThread, SIGALRM);
+        for (i = 6666; i > 0; i--) 
+            /* nothing */;
     }
     return NULL;
@@ -101,4 +110,5 @@
     {
         struct stat St;
+        int fd;
 
         rc = stat(argv[0], &St);
@@ -110,9 +120,25 @@
             break;
         }
+        
+        fd = open(szName, O_CREAT | O_RDWR, 0666);
+        if (errno == EINTR && fd < 0)
+        {
+            printf("iteration %d: open: %u\n", i, errno);
+            break;
+        }
+        close(fd);
+        rc = unlink(szName);
+        if (errno == EINTR && rc != 0)
+        {
+            printf("iteration %d: unlink: %u\n", i, errno);
+            break;
+        }
+        
+        /* Show progress info */
         if ((i % 100000) == 0)
         {
             printf(".");
             if ((i % 1000000) == 0)
-                printf("[%d/%ld]", i, g_cSigs);
+                printf("[%d/%ld/%ld]\n", i, g_cSigs, g_cSigsOther);
             fflush(stdout);
         }
