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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
0dba42cf
Commit
0dba42cf
authored
Mar 12, 2008
by
msvensson@pilot.mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve process kill on windows
parent
4dd397e4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
10 deletions
+17
-10
mysql-test/lib/My/SafeProcess.pm
mysql-test/lib/My/SafeProcess.pm
+16
-10
mysql-test/lib/My/SafeProcess/safe_process_win.cc
mysql-test/lib/My/SafeProcess/safe_process_win.cc
+1
-0
No files found.
mysql-test/lib/My/SafeProcess.pm
View file @
0dba42cf
...
...
@@ -217,7 +217,7 @@ sub timer {
}
# Child, install signal handlers and sleep for "duration"
$SIG
{
INT
}
=
'
DEFAULT
';
$SIG
{
INT
}
=
'
IGNORE
';
$SIG
{
TERM
}
=
sub
{
#print STDERR "timer $$: woken up, exiting!\n";
...
...
@@ -281,11 +281,15 @@ sub shutdown {
return
if
(
@kill_processes
==
0
);
foreach
my
$proc
(
@kill_processes
){
$proc
->
start_kill
();
if
(
$proc
->
start_kill
()
==
0
){
# Uncertain status, don't wait blocking
# for this process
$proc
->
{
WAIT_ONE_TIMEOUT
}
=
0
;
}
}
foreach
my
$proc
(
@kill_processes
){
$proc
->
wait_one
();
$proc
->
wait_one
(
$proc
->
{
WAIT_ONE_TIMEOUT
}
);
}
return
;
}
...
...
@@ -298,20 +302,20 @@ sub start_kill {
my
(
$self
)
=
@_
;
croak
"
usage:
\
$safe_proc
->start_kill()
"
unless
(
@_
==
1
and
ref
$self
);
#print "start_kill $self\n";
my
$ret
=
1
;
if
(
defined
$safe_kill
and
$self
->
{
SAFE_WINPID
}){
# Use my_safe_kill to tell my_safe_process
# it's time to kill it's child and return
my
$pid
=
$self
->
{
SAFE_WINPID
};
my
$ret
=
system
(
$safe_kill
,
$pid
);
#print STDERR "start_kill, safe_killed $pid, ret: $ret\n";
$ret
=
(
system
(
$safe_kill
,
$pid
)
>>
8
)
==
0
;
}
else
{
my
$pid
=
$self
->
{
SAFE_PID
};
die
"
Can't kill not started process
"
unless
defined
$pid
;
my
$ret
=
kill
(
15
,
$pid
);
#print STDERR "start_kill, sent signal 15 to $pid, ret: $ret\n";
$ret
=
kill
(
15
,
$pid
);
}
return
1
;
print
STDERR
"
$self
already killed
\n
"
unless
$ret
;
return
$ret
;
}
...
...
@@ -323,8 +327,10 @@ sub kill {
my
(
$self
)
=
@_
;
croak
"
usage:
\
$safe_proc
->kill()
"
unless
(
@_
==
1
and
ref
$self
);
$self
->
start_kill
();
if
(
$self
->
start_kill
())
{
$self
->
wait_one
();
}
return
1
;
}
...
...
mysql-test/lib/My/SafeProcess/safe_process_win.cc
View file @
0dba42cf
...
...
@@ -85,6 +85,7 @@ static void die(const char* fmt, ...)
va_end
(
args
);
if
(
int
last_err
=
GetLastError
())
fprintf
(
stderr
,
"error: %d, %s
\n
"
,
last_err
,
strerror
(
last_err
));
fflush
(
stderr
);
exit
(
1
);
}
...
...
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