Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
115cb41b
Commit
115cb41b
authored
Mar 10, 2008
by
msvensson@pilot.mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge pilot.mysql.com:/data/msvensson/mysql/mysql-5.1-mtr-win
into pilot.mysql.com:/data/msvensson/mysql/mysql-5.1-mtr
parents
3b7c6573
34605cc1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
4 deletions
+24
-4
mysql-test/lib/My/SafeProcess/safe_kill_win.cc
mysql-test/lib/My/SafeProcess/safe_kill_win.cc
+24
-4
No files found.
mysql-test/lib/My/SafeProcess/safe_kill_win.cc
View file @
115cb41b
...
...
@@ -29,6 +29,7 @@ int main(int argc, const char** argv )
DWORD
pid
=
-
1
;
HANDLE
shutdown_event
;
char
safe_process_name
[
32
]
=
{
0
};
int
retry_open_event
=
100
;
if
(
argc
!=
2
)
{
fprintf
(
stderr
,
"safe_kill <pid>
\n
"
);
...
...
@@ -39,14 +40,33 @@ int main(int argc, const char** argv )
_snprintf
(
safe_process_name
,
sizeof
(
safe_process_name
),
"safe_process[%d]"
,
pid
);
/* Open the event to signal */
if
((
shutdown_event
=
OpenEvent
(
EVENT_MODIFY_STATE
,
FALSE
,
safe_process_name
))
==
NULL
){
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
());
exit
(
1
);
/* 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 */
}
else
{
fprintf
(
stderr
,
"No more retries, exiting"
);
exit
(
1
);
}
}
if
(
SetEvent
(
shutdown_event
)
==
0
)
{
if
(
SetEvent
(
shutdown_event
)
==
0
)
{
fprintf
(
stderr
,
"Failed to signal shutdown_event '%s', error: %d
\n
"
,
safe_process_name
,
GetLastError
());
CloseHandle
(
shutdown_event
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment