]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Improve reporting for condition variable errors
authorMichał Kępień <michal@isc.org>
Wed, 13 Jul 2022 11:19:32 +0000 (13:19 +0200)
committerMichał Kępień <michal@isc.org>
Wed, 13 Jul 2022 11:19:32 +0000 (13:19 +0200)
Replace all uses of RUNTIME_CHECK() in lib/isc/include/isc/condition.h
with ERRNO_CHECK(), in order to improve error reporting for any
condition-variable-related run-time failures (by augmenting error
messages with file/line/caller information and the error string
corresponding to errno).

lib/isc/include/isc/condition.h

index 63d0f9834306c7319d0154fa4b7ff0bf3d1ea142..445ba4d6432cae240f5318d986d6afcd75548a83 100644 (file)
@@ -66,16 +66,29 @@ typedef pthread_cond_t isc_condition_t;
                ERRNO_CHECK(pthread_cond_init, _ret);     \
        }
 
-#define isc__condition_wait(cp, mp) \
-       RUNTIME_CHECK(pthread_cond_wait((cp), (mp)) == 0)
+#define isc__condition_wait(cp, mp)                   \
+       {                                             \
+               int _ret = pthread_cond_wait(cp, mp); \
+               ERRNO_CHECK(pthread_cond_wait, _ret); \
+       }
 
-#define isc__condition_signal(cp) RUNTIME_CHECK(pthread_cond_signal((cp)) == 0)
+#define isc__condition_signal(cp)                       \
+       {                                               \
+               int _ret = pthread_cond_signal(cp);     \
+               ERRNO_CHECK(pthread_cond_signal, _ret); \
+       }
 
-#define isc__condition_broadcast(cp) \
-       RUNTIME_CHECK(pthread_cond_broadcast((cp)) == 0)
+#define isc__condition_broadcast(cp)                       \
+       {                                                  \
+               int _ret = pthread_cond_broadcast(cp);     \
+               ERRNO_CHECK(pthread_cond_broadcast, _ret); \
+       }
 
-#define isc__condition_destroy(cp) \
-       RUNTIME_CHECK(pthread_cond_destroy((cp)) == 0)
+#define isc__condition_destroy(cp)                       \
+       {                                                \
+               int _ret = pthread_cond_destroy(cp);     \
+               ERRNO_CHECK(pthread_cond_destroy, _ret); \
+       }
 
 isc_result_t
 isc__condition_waituntil(pthread_cond_t *, pthread_mutex_t *, isc_time_t *);