56
56
57
57
@flags = ();
58
58
59
+ $maxtimoeut = $ENV {' TIMEOUTWAIT' } // 2;
59
60
$minlen = $ENV {' MINQUEUECOUNT' };
60
61
$debug = $ENV {' DEBUG' };
61
62
$silent = $ENV {' SILENT' };
@@ -635,7 +636,7 @@ sub waitforid {
635
636
lock @{$identstoidmap -> {$ident }};
636
637
637
638
638
- CORE::print (" $currpos waitin : " . Dumper2(\@{$identstoidmap -> {$ident }}));
639
+ # CORE::print("$currpos waitin : $ident, " . Dumper2(\@{$identstoidmap->{$ident}}));
639
640
640
641
foreach my $ind (@{$identstoidmap -> {$ident }}) {
641
642
lock @{$ind };
@@ -650,9 +651,12 @@ sub waitforid {
650
651
651
652
# CORE::print ("waitin on " . $ident . "\n");
652
653
653
- cond_wait( @{$identstoidmap -> {$ident }});
654
+ if (!cond_timedwait( @{$identstoidmap -> {$ident }}, time () + $maxtimoeut )) {
654
655
655
- CORE::print (" end wait on " . $ident . " \n " );
656
+ CORE::print (" $currpos waitin timed out on : $ident , \n " );
657
+ Dumper2(\@{$identstoidmap -> {$ident }});
658
+ sleep (10000)
659
+ }
656
660
}
657
661
}
658
662
@@ -761,7 +765,7 @@ sub waitforid {
761
765
$silent = 1;
762
766
$nextpos = scalar ($item [2]);
763
767
my $ntyps = scalar ($item [0]);
764
- my $ntomatch = scalar ($item [3]);
768
+ # my $ntomatch = scalar($item[3]);
765
769
# lock $typedefidentifiersvector;
766
770
$typedefidentifiersvector = [$ntyps ? {%{$qtypdfs -> peek($ntyps - 1)}} : {}]; # [{}];
767
771
# CORE::print (Dumper(\@{$typedefidentifiersvector}));
@@ -863,27 +867,22 @@ sub waitforid {
863
867
my $lastvalid = $start ;
864
868
my $tryingagainlocal ;
865
869
my $lasrtypedefobj = {%{$typedefidentifiersvector -> [0]}};
866
- my $i = 1 ;
870
+ my $i = 0 ;
867
871
my $entertryagain = 0;
868
872
while (1){
869
- if ($i ++ >= $ntomatch ) {
870
- if ($+ [0] < $nextpos ) {
871
- CORE::print " less than nextpos\n " ;
872
- CORE::print ( " fail" . pos ($subject ) . " __" .$nextpos . " \n " );
873
- $entertryagain = 1;
874
- goto tryagain
875
- }
876
- last
877
- }
873
+ # if ($i++ >= $ntomatch) {
874
+ last if ($lastvalid >= $nextpos );
875
+ # }
878
876
tryagain: # [{}];
879
877
# pos($subject) = $currposlast;
880
878
@flags = ();
881
879
@matches = ();
882
880
@savedcallouts = ();
883
881
$recording = 0;
884
882
# CORE::print ("matchin...");
885
- if ($entertryagain || !($subject =~ m {$regex } gxxs )) {
886
- # CORE::print ( "fail" . $+[0] . "__" .$nextpos . "\n" );
883
+ if (!($subject =~ m {$regex } gxxs ) || $+ [0] == $lastvalid ) {
884
+ CORE::print ( " fail" . $+ [0] . " __" .$nextpos . " \n " );
885
+ eval {reset_state()};
887
886
pos ($subject ) = $lastvalid ;
888
887
$typedefidentifiersvector = [{%{$lasrtypedefobj }}];
889
888
if ($tryingagainlocal ) {
@@ -912,7 +911,7 @@ sub waitforid {
912
911
$tryingagainlocal = 0;
913
912
$lasrtypedefobj = {%{$typedefidentifiersvector -> [0]}};
914
913
# }
915
- # CORE::print("$threadid -- $i ==========succes=============\n $&\n==========endsuccess=============\n");
914
+ CORE::print (" $threadid -- $i ==========succes=============\n $& \n ==========endsuccess=============\n " );
916
915
# pos($subject) = $+[0]
917
916
# CORE::print ("pos is to pos " . $+[0] . "\n");
918
917
# $currposlast = $+[0];
@@ -1061,7 +1060,7 @@ sub waitforid {
1061
1060
# }
1062
1061
1063
1062
if ($nqueues ) {
1064
- $q -> enqueue(([scalar ($lastntypedfs ), scalar ($lastpos ), scalar (length $subject ), scalar ( $nqueues ) + 1]));
1063
+ $q -> enqueue(([scalar ($lastntypedfs ), scalar ($lastpos ), scalar (length $subject ) - 1]));
1065
1064
}
1066
1065
1067
1066
CORE::print (" joinning for real $lastqueuepoint \n " );
0 commit comments