Skip to content

Commit 056961a

Browse files
committed
Rework using locks, nine++, ugexe++ MasterDuke++
1 parent 54a0a27 commit 056961a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/QAST/Node.nqp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,14 @@ class QAST::Node {
107107
%!annotations := nqp::null();
108108
}
109109

110-
my %global-uniques;
110+
my $uniques_lock := NQPLock.new;
111+
my %uniques;
111112
method unique($prefix) {
112-
my %uniques := nqp::clone(%global-uniques);
113+
nqp::lock($uniques_lock);
113114
my $id := nqp::existskey(%uniques, $prefix) ??
114115
(%uniques{$prefix} := %uniques{$prefix} + 1) !!
115116
(%uniques{$prefix} := 1);
116-
%global-uniques := %uniques;
117+
nqp::unlock($uniques_lock);
117118
$prefix ~ '_' ~ $id
118119
}
119120

0 commit comments

Comments
 (0)