List:Commits« Previous MessageNext Message »
From:msvensson Date:March 10 2008 3:00pm
Subject:bk commit into 5.1 tree (msvensson:1.2561)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of msvensson.  When msvensson does a push these changes
will be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2008-03-10 16:00:39+01:00, msvensson@stripped +1 -0
  Ignore all common signals
  Just retry OpenEvent a couple of times with a "yield" in between

  mysql-test/lib/My/SafeProcess/safe_kill_win.cc@stripped, 2008-03-10 16:00:34+01:00, msvensson@stripped +12 -18
    Ignore all common signals
    Just retry OpenEvent a couple of times with a "yield" in between

diff -Nrup a/mysql-test/lib/My/SafeProcess/safe_kill_win.cc b/mysql-test/lib/My/SafeProcess/safe_kill_win.cc
--- a/mysql-test/lib/My/SafeProcess/safe_kill_win.cc	2008-03-10 12:41:26 +01:00
+++ b/mysql-test/lib/My/SafeProcess/safe_kill_win.cc	2008-03-10 16:00:34 +01:00
@@ -23,6 +23,7 @@
 
 #include <windows.h>
 #include <stdio.h>
+#include <signal.h>
 
 int main(int argc, const char** argv )
 {
@@ -30,6 +31,10 @@ int main(int argc, const char** argv )
   HANDLE shutdown_event;
   char safe_process_name[32]= {0};
   int retry_open_event= 100;
+  /* Ignore any signals */
+  signal(SIGINT,   SIG_IGN);
+  signal(SIGBREAK, SIG_IGN);
+  signal(SIGTERM,  SIG_IGN);
 
   if (argc != 2) {
     fprintf(stderr, "safe_kill <pid>\n");
@@ -37,31 +42,20 @@ int main(int argc, const char** argv )
   }
   pid= atoi(argv[1]);
 
-  _snprintf(safe_process_name, sizeof(safe_process_name), "safe_process[%d]", pid);
+  _snprintf(safe_process_name, sizeof(safe_process_name),
+            "safe_process[%d]", pid);
 
   /* Open the event to signal */
   while ((shutdown_event=
           OpenEvent(EVENT_MODIFY_STATE, FALSE, safe_process_name)) == NULL)
   {
-    fprintf(stderr, "Failed to open shutdown_event '%s', error: %d\n",
-            safe_process_name, GetLastError());
-
-    /* Just check to see if pid exists */
-    HANDLE pid_handle= OpenProcess(SYNCHRONIZE, FALSE, pid);
-    if (pid_handle == NULL)
-      fprintf(stderr, "Could not open process with pid %d, error: %d\n", pid);
-	else
-	  CloseHandle(pid_handle);
-
     if (retry_open_event--)
-    {
-      fprintf(stderr, "retrying...\n");
-      Sleep(100); /* In milli seconds */
-    }
+      Sleep(0); /* yield */
     else
     {
-      fprintf(stderr, "No more retries, exiting");
-      exit(1);
+      fprintf(stderr, "Failed to open shutdown_event '%s', error: %d\n",
+            safe_process_name, GetLastError());
+      exit(3);
     }
   }
 
@@ -70,7 +64,7 @@ int main(int argc, const char** argv )
     fprintf(stderr, "Failed to signal shutdown_event '%s', error: %d\n",
             safe_process_name, GetLastError());
     CloseHandle(shutdown_event);
-    exit(1);
+    exit(4);
   }
   CloseHandle(shutdown_event);
   exit(0);
Thread
bk commit into 5.1 tree (msvensson:1.2561)msvensson10 Mar