@@ -494,7 +494,7 @@ sub instantiate_cached_instance {
494
494
495
495
# exit if(not $matchinperl);
496
496
497
- startmodule(basename($ARGV [-1]) . " _base" ) if (defined &startmodule and not $nested );
497
+ # startmodule(basename($ARGV[-1]) . "_base") if(defined &startmodule and not $nested);
498
498
499
499
# my $matchprototype = qr{(?(DEFINE)$mainregexdefs)^((??{set {"decls" => "extrnl"}})(?&abstdeclorallqualifs)(??{unset {"decls" => "extrnl"}}))}sxxn;
500
500
# my $matchtype = qr{(?(DEFINE)$mainregexdefs)(?&abstdeclorallqualifs)}sxxn;
@@ -568,22 +568,6 @@ sub findnearest {
568
568
569
569
sub getidtostor {
570
570
return pos ();
571
-
572
- my $ident = $_ [0];
573
- my $currpos = pos ();
574
- CORE::print (" getting for $ident \n " );
575
- {
576
- lock $identstoidmap ;
577
- return -1 if (not exists $identstoidmap -> {$ident });
578
- lock %{$identstoidmap -> {$ident }};
579
- # CORE::print("dump " . $ident);
580
-
581
- @identscurr = keys %{$identstoidmap -> {$ident }};
582
-
583
- $idtosignal = (findnearest($currpos , @identscurr , 1))[0];
584
-
585
- return $idtosignal
586
- }
587
571
}
588
572
589
573
sub broadcastid {
@@ -592,20 +576,15 @@ sub broadcastid {
592
576
my $locker ;
593
577
# CORE::print("dump " . $ident ."\n");
594
578
{
595
- lock $identstoidmap ;
596
579
# return -1 if (not exists $identstoidmap->{$ident});
597
- lock %{$identstoidmap -> {$ident }};
598
-
599
- $locker = $identstoidmap -> {$ident };
600
- }
601
- {
602
- lock %{$locker };
580
+ lock @{$identstoidmap -> {$ident }};
603
581
604
582
CORE::print (" signalling over " . $idtosignal . " \n " );
605
583
606
- $locker -> {$idtosignal } = 1;
584
+ push @{$identstoidmap -> {$ident }}, $idtosignal ;
585
+
607
586
608
- cond_broadcast(%{ $locker })
587
+ cond_broadcast(@{ $identstoidmap -> { $ident } })
609
588
}
610
589
611
590
# CORE::print ("signalling " . $idtosignal . "\n");
@@ -618,50 +597,35 @@ sub waitforid {
618
597
my $ident = $_ [0];
619
598
my @identscur ;
620
599
my @idtosignal ;
621
- my $locker ;
622
-
623
- {
624
- lock $identstoidmap ;
625
- return -1 if (not exists $identstoidmap -> {$ident });
626
- # lock %{$identstoidmap->{$ident}};
627
-
628
- # CORE::print("dump " . Dumper(\$identstoidmap->{$_[0]}));
629
-
630
- # @identscurr = keys %{$identstoidmap->{$ident}};
631
-
632
- # @idtosignal = findnearest($currpos, @identscurr, 0);
633
-
634
- # return -1 if (not scalar (@idtosignal));
635
-
636
- # CORE::print("nearest " . $idtosignal . "\n");
637
-
638
- # return -1 if ($idtosignal eq -1);
639
-
640
- $locker = $identstoidmap -> {$ident };
641
- C# ORE::print("there " . $idtosignal . "\n");
642
- }
600
+ my @locker ;
643
601
644
602
while (1)
645
603
{
646
604
647
605
{
648
606
# lock $identstoidmap->{$_[0]}->{$idtosignal};
607
+ {
608
+
609
+ lock $identstoidmap ;
610
+ return -1 if (not exists $identstoidmap -> {$ident });
611
+ }
649
612
650
- lock %{ $locker };
613
+ lock @{ $identstoidmap -> { $ident } };
651
614
652
- CORE::print (" $currpos waitin : " . Dumper2(\%{$locker }));
653
615
654
- foreach my $ind (keys %{$locker }) {
655
- CORE::print (" check map $ind \n " );
656
- if ($locker -> {$ind } and $ind <= $currpos ) {
657
- CORE::print (" foind on " . $ident . " - $id \n " );
658
- return $ind ;
616
+ # CORE::print("$currpos waitin : " . Dumper2(\@{$locker}));
617
+
618
+ foreach my $ind (@{$identstoidmap -> {$ident }}) {
619
+ CORE::print (" check map $ind \n " );
620
+ if ($ind <= $currpos ) {
621
+ CORE::print (" foind on " . $ident . " - $ind \n " );
622
+ return $ind ;
623
+ }
659
624
}
660
- }
661
625
662
626
CORE::print (" waitin on " . $ident . " \n " );
663
627
664
- cond_wait(%{ $locker });
628
+ cond_wait(@{ $identstoidmap -> { $ident } });
665
629
666
630
CORE::print (" end wait on " . $ident . " \n " );
667
631
}
@@ -1132,7 +1096,7 @@ sub waitforid {
1132
1096
if ($subject =~ m {$typeorqualifsreg$initseqlight \G (?&brackets)\s *+} sxx ) {
1133
1097
pos ($subject ) = $+ [0];
1134
1098
lock $identstoidmap ;
1135
- $identstoidmap -> {$possibleidentlocal } = shared_clone({} ) if (not exists $identstoidmap -> {$possibleidentlocal });
1099
+ $identstoidmap -> {$possibleidentlocal } = shared_clone([] ) if (not exists $identstoidmap -> {$possibleidentlocal });
1136
1100
# lock %{$identstoidmap->{$possibleidentlocal}};
1137
1101
# lock $identstoidmap->{$possibleident};
1138
1102
CORE::print (" tag setting $possibleidentlocal @ $lastposend \n " );
@@ -1173,7 +1137,7 @@ sub waitforid {
1173
1137
}
1174
1138
elsif ($possibleident ) {
1175
1139
lock $identstoidmap ;
1176
- $identstoidmap -> {$possibleident } = shared_clone({} ) if (not exists $identstoidmap -> {$possibleident });
1140
+ $identstoidmap -> {$possibleident } = shared_clone([] ) if (not exists $identstoidmap -> {$possibleident });
1177
1141
# lock %{$identstoidmap->{$possibleident}};
1178
1142
# lock $identstoidmap->{$possibleident};
1179
1143
CORE::print (" setting $possibleident - $lastposend \n " );
0 commit comments