diff options
author | Paul Adenot <[email protected]> | 2022-09-21 16:22:45 -0700 |
---|---|---|
committer | Paul Adenot <[email protected]> | 2022-09-22 23:36:04 +0200 |
commit | e9abb07824b14f8ff0b9168be733fc431cac8cdf (patch) | |
tree | da22c52435083cb671fa7073d99e037f7d4f3b60 /src/cubeb_pulse.c | |
parent | bc0450628e120dbee89fb8ad0b29abbd24dc3729 (diff) | |
download | cubeb-e9abb07824b14f8ff0b9168be733fc431cac8cdf.tar.gz cubeb-e9abb07824b14f8ff0b9168be733fc431cac8cdf.zip |
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.
Diffstat (limited to 'src/cubeb_pulse.c')
-rw-r--r-- | src/cubeb_pulse.c | 4 |
1 files changed, 2 insertions, 2 deletions
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) == |