summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2020-06-01 18:40:16 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2020-06-01 18:44:34 +0200
commit729f74b7cf06ebd44aa8d9e3192276f47055ca13 (patch)
treebb39543abae6e5e4ca929f093b662228e7c31db4
parent356d52e1852c7bec071cb142352ce7b87eaac2f4 (diff)
libfshelp: destroy condition variable before freeing it
To make sure that threads have really woken up. Spotted by Richard Braun. * libfshelp/rlock-drop-peropen.c (fshelp_rlock_drop_peropen): Call pthread_cond_destroy before freeing the condition variable. * libfshelp/rlock-tweak.c (fshelp_rlock_tweak): Likewise.
-rw-r--r--libfshelp/rlock-drop-peropen.c1
-rw-r--r--libfshelp/rlock-tweak.c1
2 files changed, 2 insertions, 0 deletions
diff --git a/libfshelp/rlock-drop-peropen.c b/libfshelp/rlock-drop-peropen.c
index 91383d2f..86453dd7 100644
--- a/libfshelp/rlock-drop-peropen.c
+++ b/libfshelp/rlock-drop-peropen.c
@@ -39,6 +39,7 @@ fshelp_rlock_drop_peropen (struct rlock_peropen *po)
}
list_unlink (node, l);
+ pthread_cond_destroy(&l->wait);
t = l->po.next;
free (l);
diff --git a/libfshelp/rlock-tweak.c b/libfshelp/rlock-tweak.c
index b0f4b9f5..8be88993 100644
--- a/libfshelp/rlock-tweak.c
+++ b/libfshelp/rlock-tweak.c
@@ -70,6 +70,7 @@ fshelp_rlock_tweak (struct rlock_box *box, pthread_mutex_t *mutex,
if (wake_waiters && l->waiting)
pthread_cond_broadcast (&l->wait);
+ pthread_cond_destroy(&l->wait);
free (l);
}