Displaying 1 result from an estimated 1 matches for "995f46c".
Did you mean:
995461
2019 Apr 23
1
[RFC: nbdkit PATCH] cleanup: Assert mutex sanity
...RENT_SCOPE(mutex) \
CLEANUP_UNLOCK pthread_mutex_t *_lock = mutex; \
- pthread_mutex_lock (_lock)
+ do { \
+ int _r = pthread_mutex_lock (_lock); \
+ assert (!_r); \
+ } while (0)
#endif /* NBDKIT_CLEANUP_H */
diff --git a/common/utils/cleanup.c b/common/utils/cleanup.c
index 196d910..995f46c 100644
--- a/common/utils/cleanup.c
+++ b/common/utils/cleanup.c
@@ -53,5 +53,6 @@ cleanup_extents_free (void *ptr)
void
cleanup_unlock (pthread_mutex_t **ptr)
{
- pthread_mutex_unlock (*ptr);
+ int r = pthread_mutex_unlock (*ptr);
+ assert (!r);
}
--
2.20.1