From: Michał Kępień Date: Wed, 13 Jul 2022 11:19:32 +0000 (+0200) Subject: Improve reporting for condition variable errors X-Git-Tag: v9.19.4~31^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=badeeff0acf34b36250579970329fe0cd53cbe87;p=thirdparty%2Fbind9.git Improve reporting for condition variable errors 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). --- diff --git a/lib/isc/include/isc/condition.h b/lib/isc/include/isc/condition.h index 63d0f983430..445ba4d6432 100644 --- a/lib/isc/include/isc/condition.h +++ b/lib/isc/include/isc/condition.h @@ -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 *);