From e9abb07824b14f8ff0b9168be733fc431cac8cdf Mon Sep 17 00:00:00 2001 From: Paul Adenot Date: Wed, 21 Sep 2022 16:22:45 -0700 Subject: Make the log callback and level atomic It's useful to be able to enable logging dynamically while the program is running, and this can now be done on any thread. Various threads are logging (directly or asynchronously via the ring buffer), it's better to have those atomic. Both values are always checked before logging, and both must be non-null to log. --- src/cubeb_pulse.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/cubeb_pulse.c') diff --git a/src/cubeb_pulse.c b/src/cubeb_pulse.c index fc8fbf4..6866405 100644 --- a/src/cubeb_pulse.c +++ b/src/cubeb_pulse.c @@ -1025,7 +1025,7 @@ pulse_stream_init(cubeb * context, cubeb_stream ** stream, return CUBEB_ERROR; } - if (g_cubeb_log_level) { + if (cubeb_log_get_level()) { if (output_stream_params) { const pa_buffer_attr * output_att; output_att = WRAP(pa_stream_get_buffer_attr)(stm->output_stream); @@ -1578,7 +1578,7 @@ pulse_subscribe_callback(pa_context * ctx, pa_subscription_event_type_t t, case PA_SUBSCRIPTION_EVENT_SOURCE: case PA_SUBSCRIPTION_EVENT_SINK: - if (g_cubeb_log_level) { + if (cubeb_log_get_level()) { if ((t & PA_SUBSCRIPTION_EVENT_FACILITY_MASK) == PA_SUBSCRIPTION_EVENT_SOURCE && (t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == -- cgit v1.2.3