From fc6a7def0b37c8f2b1298c3dc761dd8c9e09ebf0 Mon Sep 17 00:00:00 2001 From: Magnus Svensson Date: Wed, 8 Oct 2008 22:02:32 +0200 Subject: [PATCH] WL#4189 NO need to retry OpenEvent if the process does not exist anymore --- mysql-test/lib/My/SafeProcess/safe_kill_win.cc | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/mysql-test/lib/My/SafeProcess/safe_kill_win.cc b/mysql-test/lib/My/SafeProcess/safe_kill_win.cc index 9955a9f72f2..c6256fd92e1 100755 --- a/mysql-test/lib/My/SafeProcess/safe_kill_win.cc +++ b/mysql-test/lib/My/SafeProcess/safe_kill_win.cc @@ -49,12 +49,25 @@ int main(int argc, const char** argv ) while ((shutdown_event= OpenEvent(EVENT_MODIFY_STATE, FALSE, safe_process_name)) == NULL) { + /* + Check if the process is alive, otherwise there is really + no idea to retry the open of the event + */ + HANDLE process; + if ((process= OpenProcess(SYNCHRONIZE, FALSE, pid)) == NULL) + { + fprintf(stderr, "Could not open event or process %d, error: %d\n", + pid, GetLastError()); + exit(3); + } + CloseHandle(process); + if (retry_open_event--) Sleep(100); else { fprintf(stderr, "Failed to open shutdown_event '%s', error: %d\n", - safe_process_name, GetLastError()); + safe_process_name, GetLastError()); exit(3); } }