File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -387,6 +387,7 @@ vdire_new(struct lock *mtx, const struct vcltemp **tempp)
387
387
VTAILQ_INIT (& vdire -> directors );
388
388
VTAILQ_INIT (& vdire -> resigning );
389
389
vdire -> mtx = mtx ;
390
+ PTOK (pthread_cond_init (& vdire -> cond , NULL ));
390
391
vdire -> tempp = tempp ;
391
392
return (vdire );
392
393
}
@@ -399,6 +400,8 @@ vdire_start_iter(struct vdire *vdire)
399
400
CHECK_OBJ_NOTNULL (vdire , VDIRE_MAGIC );
400
401
401
402
Lck_Lock (vdire -> mtx );
403
+ while (! VTAILQ_EMPTY (& vdire -> resigning ))
404
+ (void )Lck_CondWait (& vdire -> cond , vdire -> mtx );
402
405
vdire -> iterating ++ ;
403
406
Lck_Unlock (vdire -> mtx );
404
407
}
@@ -422,6 +425,7 @@ vdire_end_iter(struct vdire *vdire)
422
425
VTAILQ_FOREACH (vdir , & resigning , resigning_list )
423
426
VTAILQ_REMOVE (& vdire -> directors , vdir , directors_list );
424
427
temp = * vdire -> tempp ;
428
+ PTOK (pthread_cond_broadcast (& vdire -> cond ));
425
429
}
426
430
Lck_Unlock (vdire -> mtx );
427
431
@@ -653,6 +657,7 @@ VCL_Close(struct vcl **vclp)
653
657
TAKE_OBJ_NOTNULL (vcl , vclp , VCL_MAGIC );
654
658
assert (VTAILQ_EMPTY (& vcl -> filters ));
655
659
AZ (dlclose (vcl -> dlh ));
660
+ PTOK (pthread_cond_destroy (& vcl -> vdire -> cond ));
656
661
FREE_OBJ (vcl -> vdire );
657
662
FREE_OBJ (vcl );
658
663
}
Original file line number Diff line number Diff line change @@ -47,6 +47,8 @@ struct vdire {
47
47
struct vcldir_head resigning ;
48
48
// vcl_mtx for now - to be refactored into separate mtx?
49
49
struct lock * mtx ;
50
+ // to signal when iterators can enter again
51
+ pthread_cond_t cond ;
50
52
const struct vcltemp * * tempp ;
51
53
};
52
54
You can’t perform that action at this time.
0 commit comments