Skip to content
Snippets Groups Projects
Commit bdbb481a authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Add an ignored version of rwlock_destroy() for use when it there's

really no useful way to recover from failure.
parent 1a78a041
No related branches found
No related tags found
1 merge request!455Update branch with changes from master
......@@ -270,25 +270,25 @@ static void internal_do_cryptInit(void)
if (!rwlock_init(&cert_epoch_lock))
return;
if (!rwlock_init(&tls_cert_file_date_lock)) {
rwlock_destroy(&cert_epoch_lock);
rwlock_destroy_ign(&cert_epoch_lock);
return;
}
if (pthread_mutex_init(&ssl_cert_list_mutex, NULL) != 0) {
rwlock_destroy(&tls_cert_file_date_lock);
rwlock_destroy(&cert_epoch_lock);
rwlock_destroy_ign(&tls_cert_file_date_lock);
rwlock_destroy_ign(&cert_epoch_lock);
return;
}
if (pthread_mutex_init(&ssl_sess_list_mutex, NULL) != 0) {
pthread_mutex_destroy(&ssl_cert_list_mutex);
rwlock_destroy(&tls_cert_file_date_lock);
rwlock_destroy(&cert_epoch_lock);
rwlock_destroy_ign(&tls_cert_file_date_lock);
rwlock_destroy_ign(&cert_epoch_lock);
return;
}
if (pthread_mutex_init(&get_ssl_cert_mutex, NULL) != 0) {
pthread_mutex_destroy(&ssl_sess_list_mutex);
pthread_mutex_destroy(&ssl_cert_list_mutex);
rwlock_destroy(&tls_cert_file_date_lock);
rwlock_destroy(&cert_epoch_lock);
rwlock_destroy_ign(&tls_cert_file_date_lock);
rwlock_destroy_ign(&cert_epoch_lock);
return;
}
......
......@@ -13,6 +13,7 @@ typedef pthread_rwlock_t rwlock_t;
#define rwlock_trywrlock(lock) (pthread_rwlock_trywrlock(lock) == 0)
#define rwlock_unlock(lock) (pthread_rwlock_unlock(lock) == 0)
#define rwlock_destroy(lock) (pthread_rwlock_destroy(lock) == 0)
#define rwlock_destroy_ign(lock) ((void)pthread_rwlock_destroy(lock))
#elif defined(_WIN32)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment