@@ -73,7 +73,7 @@ const int64_t EXP_THRESH = 31;
73
73
// Notifies ProverManager class each time there's a new event.
74
74
bool new_event = false ;
75
75
std::condition_variable new_event_cv;
76
- std::mutex new_event_mutex;
76
+ std::mutex new_event_mutex, cout_lock ;
77
77
78
78
bool debug_mode = false ;
79
79
bool fast_algorithm = false ;
@@ -231,8 +231,12 @@ void repeated_square(form f, const integer& D, const integer& L,
231
231
}
232
232
#endif
233
233
}
234
+ {
235
+ // this shouldn't be needed but avoids some false positive in TSAN
236
+ std::lock_guard<std::mutex> lk (cout_lock);
237
+ std::cout << " VDF loop finished. Total iters: " << num_iterations << " \n " << std::flush;
238
+ }
234
239
235
- std::cout << " VDF loop finished. Total iters: " << num_iterations << " \n " << std::flush;
236
240
#ifdef VDF_TEST
237
241
print ( " fast average batch size" , double (num_iterations_fast)/double (num_calls_fast) );
238
242
print ( " fast iterations per slow iteration" , double (num_iterations_fast)/double (num_iterations_slow) );
@@ -266,7 +270,11 @@ Proof ProveOneWesolowski(uint64_t iters, integer& D, form f, OneWesolowskiCallba
266
270
proof_serialized = SerializeForm (proof_form, d_bits);
267
271
Proof proof (y_serialized, proof_serialized);
268
272
proof.witness_type = 0 ;
269
- std::cout << " Got simple weso proof: " << proof.hex () << " \n " ;
273
+ {
274
+ // this shouldn't be needed but avoids some false positive in TSAN
275
+ std::lock_guard<std::mutex> lk (cout_lock);
276
+ std::cout << " Got simple weso proof: " << proof.hex () << " \n " ;
277
+ }
270
278
return proof;
271
279
}
272
280
0 commit comments