Fix lockup when running Valgrind. Ref #685 (#699)

This commit is contained in:
jmpenn 2018-11-09 13:40:11 -06:00 committed by GitHub
parent 51ddcfaae0
commit ca35092c1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -276,9 +276,9 @@ int Trick::DataRecordDispatcher::dmtcp_restart() {
int Trick::DataRecordDispatcher::shutdown() {
if ( drd_writer_thread.get_pthread_id() != 0 ) {
// TODO: we could lock up here on the trylock.
while (pthread_mutex_trylock(&drd_mutexes.dr_go_mutex));
pthread_cancel(drd_writer_thread.get_pthread_id()) ;
pthread_mutex_lock( &drd_mutexes.dr_go_mutex);
pthread_cancel( drd_writer_thread.get_pthread_id()) ;
pthread_mutex_unlock( &drd_mutexes.dr_go_mutex);
}
return(0) ;