Skip to content
Permalink
Browse files

Fix potential race condition in EVAL (#2015)

Fix potential race condition in EVAL
  • Loading branch information...
ugexe committed Jul 3, 2018
1 parent 513577c commit 80bbfbb36a3b358e29b94e6f7bd61a8c54ea026b
Showing with 9 additions and 2 deletions.
  1. +9 −2 src/Perl6/Grammar.nqp
@@ -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;
@@ -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 := (

0 comments on commit 80bbfbb

Please sign in to comment.
You can’t perform that action at this time.