add missing lock/unlock on pthread map mutex to VariableServer::shutdown fixes #1133 (#1134)

closes #1133
This commit is contained in:
Scott Fennell 2021-04-26 23:28:26 -05:00 committed by GitHub
parent 1b978ef2da
commit d75faecff8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,10 +4,12 @@
int Trick::VariableServer::shutdown() {
listen_thread.cancel_thread() ;
std::map < pthread_t , VariableServerThread * >::iterator it ;
pthread_mutex_lock(&map_mutex) ;
for ( it = var_server_threads.begin() ; it != var_server_threads.end() ; it++ ) {
(*it).second->cancel_thread() ;
// cancelling causes each var_server_thread map element to be erased by the exit_var_thread function
}
pthread_mutex_unlock(&map_mutex) ;
return 0 ;
}