Created
June 2, 2017 13:02
-
-
Save zoffixznet/7d3b2d9fae28c2d18fc4bdef6e68cc59 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cpan@perlbuild4~/CPANPRC/rakudo (nom)$ ./perl6 -e 'await ^2 .map: {start { with Proc::Async.new: $*EXECUTABLE, "-e", "say q|started $*PID|; sleep" -> $p { Promise.in(4).then: {say "Killing " ~ $p.WHERE; $p.kill: SIGTERM}; await $p.start } }}' | |
started 4232 | |
started 4232 | |
Killing 140685500656888 | |
Killing 140685513246336 | |
Calling kill (a 140685500656888) | |
Calling kill (a 140685513246336) | |
Calling kill (b 140685500656888) | |
Calling kill (b 140685513246336) | |
Teh op?! | |
Killing a! | |
Doing stuff a! | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cpan@perlbuild4~/CPANPRC/rakudo (nom)$ gd | |
diff --git a/src/core/Proc/Async.pm b/src/core/Proc/Async.pm | |
index 550f42e..e9158e4 100644 | |
--- a/src/core/Proc/Async.pm | |
+++ b/src/core/Proc/Async.pm | |
@@ -222,7 +222,9 @@ my class Proc::Async { | |
} | |
method kill(Proc::Async:D: $signal = "HUP") { | |
+ say "Calling kill (a {self.WHERE})"; | |
X::Proc::Async::MustBeStarted.new(:method<kill>, proc => self).throw if !$!started; | |
+ say "Calling kill (b {self.WHERE})"; | |
nqp::killprocasync($!process_handle, $*KERNEL.signal($signal)); | |
} | |
} | |
cpan@perlbuild4~/CPANPRC/rakudo (nom)$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cpan@perlbuild4~/CPANPRC/rakudo/nqp/MoarVM ((detached from 62bc54e))$ gd | |
diff --git a/src/io/procops.c b/src/io/procops.c | |
index 9ee3cc4..30e6857 100644 | |
--- a/src/io/procops.c | |
+++ b/src/io/procops.c | |
@@ -1072,12 +1072,15 @@ MVMObject * MVM_proc_spawn_async(MVMThreadContext *tc, MVMObject *queue, MVMObje | |
/* Kills an asynchronously spawned process. */ | |
void MVM_proc_kill_async(MVMThreadContext *tc, MVMObject *handle_obj, MVMint64 signal) { | |
/* Ensure it's a handle for a process. */ | |
+ printf("Teh op?!\n"); | |
if (REPR(handle_obj)->ID == MVM_REPR_ID_MVMOSHandle) { | |
MVMOSHandle *handle = (MVMOSHandle *)handle_obj; | |
+ printf("Killing a!\n"); | |
if (handle->body.ops == &proc_op_table) { | |
/* It's fine; send the kill by cancelling the task. */ | |
MVMIOAsyncProcessData *data = (MVMIOAsyncProcessData *)handle->body.data; | |
data->signal = signal; | |
+ printf("Doing stuff a!\n"); | |
MVM_io_eventloop_cancel_work(tc, data->async_task, NULL, NULL); | |
return; | |
} | |
cpan@perlbuild4~/CPANPRC/rakudo/nqp/MoarVM ((detached from 62bc54e))$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment