@@ -95,6 +95,7 @@ pub(super) struct COVER_epoch_info_t {
9595}
9696
9797pub ( super ) struct COVER_best_t_inner {
98+ pub ( super ) liveJobs : size_t ,
9899 pub ( super ) dict : Box < [ u8 ] > ,
99100 pub ( super ) dictSize : size_t ,
100101 pub ( super ) parameters : ZDICT_cover_params_t ,
@@ -104,6 +105,7 @@ pub(super) struct COVER_best_t_inner {
104105impl COVER_best_t_inner {
105106 pub ( crate ) fn new ( ) -> Self {
106107 Self {
108+ liveJobs : 0 ,
107109 dict : Box :: default ( ) ,
108110 dictSize : 0 ,
109111 compressedSize : -( 1 as core:: ffi:: c_int ) as size_t ,
@@ -115,15 +117,13 @@ impl COVER_best_t_inner {
115117pub ( super ) struct COVER_best_t {
116118 pub ( super ) mutex : Mutex < COVER_best_t_inner > ,
117119 pub ( super ) cond : Condvar ,
118- pub ( super ) liveJobs : size_t ,
119120}
120121
121122impl COVER_best_t {
122123 pub ( crate ) fn new ( ) -> Self {
123124 Self {
124125 mutex : Mutex :: new ( COVER_best_t_inner :: new ( ) ) ,
125126 cond : Condvar :: new ( ) ,
126- liveJobs : 0 ,
127127 }
128128 }
129129}
@@ -971,15 +971,15 @@ pub(super) fn COVER_best_wait(
971971) -> std:: sync:: MutexGuard < ' _ , COVER_best_t_inner > {
972972 let mut guard = best. mutex . lock ( ) . unwrap ( ) ;
973973 #[ expect( clippy:: while_immutable_condition) ]
974- while best . liveJobs != 0 {
974+ while guard . liveJobs != 0 {
975975 guard = best. cond . wait ( guard) . unwrap ( ) ;
976976 }
977977 guard
978978}
979979
980980pub ( super ) fn COVER_best_start ( best : & mut COVER_best_t ) {
981- let _guard = best. mutex . lock ( ) . unwrap ( ) ;
982- best . liveJobs += 1 ;
981+ let mut guard = best. mutex . lock ( ) . unwrap ( ) ;
982+ guard . liveJobs += 1 ;
983983}
984984
985985pub ( super ) fn COVER_best_finish (
@@ -991,8 +991,8 @@ pub(super) fn COVER_best_finish(
991991 let dictSize = selection. dictSize ;
992992 let mut liveJobs: size_t = 0 ;
993993 let mut guard = best. mutex . lock ( ) . unwrap ( ) ;
994- best . liveJobs = ( best . liveJobs ) . wrapping_sub ( 1 ) ;
995- liveJobs = best . liveJobs ;
994+ guard . liveJobs = ( guard . liveJobs ) . wrapping_sub ( 1 ) ;
995+ liveJobs = guard . liveJobs ;
996996 if compressedSize < guard. compressedSize {
997997 if let Some ( slice) = guard. dict . get_mut ( ..selection. dictContent . len ( ) ) {
998998 slice. copy_from_slice ( & selection. dictContent ) ;
0 commit comments