Skip to content

Commit

Permalink
Pass :hint-affinity to scheduler in some places
Browse files Browse the repository at this point in the history
These are cases where the input is arriving to be emitted by a Supply,
and thus having multiple threads scrambling to handle the input will
do more harm than good. Ignored by the current thread pool scheduler,
but will be used by the upcoming new one.
  • Loading branch information
jnthn committed Sep 13, 2017
1 parent 760530a commit d2eb742
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/core/IO/Notification.pm
Expand Up @@ -19,7 +19,7 @@ my class IO::Notification {
my $is-dir = $path.IO.d;
my $s = Supplier.new;
nqp::watchfile(
$scheduler.queue,
$scheduler.queue(:hint-affinity),
-> \path, \rename, \err {
if err {
$s.quit(err);
Expand Down
7 changes: 4 additions & 3 deletions src/core/IO/Socket/Async.pm
Expand Up @@ -55,7 +55,8 @@ my class IO::Socket::Async {
my $cancellation;
Supply.on-demand:
-> $supply {
$cancellation := nqp::asyncreadbytes($!VMIO, $scheduler.queue,
$cancellation := nqp::asyncreadbytes($!VMIO,
$scheduler.queue(:hint-affinity),
capture($supply), nqp::decont($buf), SocketCancellation);
$!close-promise.then({ $supply.done });
},
Expand Down Expand Up @@ -119,7 +120,7 @@ my class IO::Socket::Async {
my $encoding = Encoding::Registry.find($enc);
Supply.on-demand(-> $s {
$cancellation := nqp::asynclisten(
$scheduler.queue,
$scheduler.queue(:hint-affinity),
-> Mu \socket, Mu \err, Mu \peer-host, Mu \peer-port, Mu \socket-host, Mu \socket-port {
if err {
$s.quit(err);
Expand Down Expand Up @@ -189,7 +190,7 @@ my class IO::Socket::Async {
my $p = Promise.new;
my $encoding = Encoding::Registry.find($enc);
nqp::asyncudp(
$scheduler.queue,
$scheduler.queue(:hint-affinity),
-> Mu \socket, Mu \err {
if err {
$p.break(err);
Expand Down
2 changes: 1 addition & 1 deletion src/core/Proc/Async.pm
Expand Up @@ -337,7 +337,7 @@ my class Proc::Async {
nqp::bindkey($callbacks, 'stdout_fd', $!stdout-fd) if $!stdout-fd.DEFINITE;
nqp::bindkey($callbacks, 'stderr_fd', $!stderr-fd) if $!stderr-fd.DEFINITE;

$!process_handle := nqp::spawnprocasync($scheduler.queue,
$!process_handle := nqp::spawnprocasync($scheduler.queue(:hint-affinity),
CLONE-LIST-DECONTAINERIZED($!path,@!args),
$cwd.Str,
CLONE-HASH-DECONTAINERIZED(%ENV),
Expand Down

0 comments on commit d2eb742

Please sign in to comment.