Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make say/print/note do a single VM I/O op.
This means two operations on the same handle done by two threads will
come out ordered.
  • Loading branch information
jnthn committed May 4, 2015
1 parent f8baa95 commit a4d1d5f
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/core/IO.nqp
Expand Up @@ -49,22 +49,18 @@ sub spew($filename, $contents) {
}

sub print(*@args) {
for @args {
nqp::print($_);
}
nqp::print(join('', @args));
1;
}

sub say(*@args) {
print(|@args, "\n");
nqp::say(join('', @args));
1;
}

sub note(*@args) {
my $err := nqp::getstderr();
for @args {
nqp::printfh($err, $_);
}
nqp::printfh($err, "\n");
nqp::sayfh(nqp::getstderr(), join('', @args));
1;
}

sub join($delim, @things) {
Expand Down

0 comments on commit a4d1d5f

Please sign in to comment.