Skip to content

Commit

Permalink
Fix potential race condition in EVAL (#2015)
Browse files Browse the repository at this point in the history
Fix potential race condition in EVAL
  • Loading branch information
ugexe committed Jul 3, 2018
1 parent 513577c commit 80bbfbb
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/Perl6/Grammar.nqp
Expand Up @@ -472,7 +472,14 @@ role STD {
}
grammar Perl6::Grammar is HLL::Grammar does STD {
my $sc_id := 0;
my class SerializationContextId {
my $count := 0;
my $lock := NQPLock.new;
method next-id() {
$lock.protect({ $count++ })
}
}
method TOP() {
# Language braid.
my $*LANG := self;
Expand Down Expand Up @@ -520,7 +527,7 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
my $file := nqp::getlexdyn('$?FILES');
my $source_id := nqp::sha1($file ~ (
nqp::defined(%*COMPILING<%?OPTIONS><outer_ctx>)
?? self.target() ~ $sc_id++
?? self.target() ~ SerializationContextId.next-id()
!! self.target()));
my $outer_world := nqp::getlexdyn('$*W');
my $is_nested := (
Expand Down

0 comments on commit 80bbfbb

Please sign in to comment.