[vlc-devel] [PATCH 4/6] coreaudio: unfair_lock availability is very likely
Thomas Guillem
thomas at gllm.fr
Fri Aug 16 10:55:34 CEST 2019
---
modules/audio_output/coreaudio_common.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/modules/audio_output/coreaudio_common.c b/modules/audio_output/coreaudio_common.c
index c25eaae1ca..a06fd7f173 100644
--- a/modules/audio_output/coreaudio_common.c
+++ b/modules/audio_output/coreaudio_common.c
@@ -87,7 +87,7 @@ ca_OnceInit(void)
static void
lock_init(struct aout_sys_common *p_sys)
{
- if (unfair_lock.lock)
+ if (likely(unfair_lock.lock))
p_sys->lock.unfair = OS_UNFAIR_LOCK_INIT;
else
vlc_mutex_init(&p_sys->lock.mutex);
@@ -96,14 +96,14 @@ lock_init(struct aout_sys_common *p_sys)
static void
lock_destroy(struct aout_sys_common *p_sys)
{
- if (!unfair_lock.lock)
+ if (unlikely(!unfair_lock.lock))
vlc_mutex_destroy(&p_sys->lock.mutex);
}
static void
lock_lock(struct aout_sys_common *p_sys)
{
- if (unfair_lock.lock)
+ if (likely(unfair_lock.lock))
unfair_lock.lock(&p_sys->lock.unfair);
else
vlc_mutex_lock(&p_sys->lock.mutex);
@@ -112,7 +112,7 @@ lock_lock(struct aout_sys_common *p_sys)
static void
lock_unlock(struct aout_sys_common *p_sys)
{
- if (unfair_lock.lock)
+ if (likely(unfair_lock.lock))
unfair_lock.unlock(&p_sys->lock.unfair);
else
vlc_mutex_unlock(&p_sys->lock.mutex);
--
2.20.1
More information about the vlc-devel
mailing list