[vlc-devel] [PATCH] mutex: remove write-only variable
Steve Lhomme
robux4 at ycbcr.xyz
Wed Jan 13 06:53:02 UTC 2021
LGTM as well
While there you may also fix the grammar in
"The mutex can value be:"
On 2021-01-12 17:53, remi at remlab.net wrote:
> From: RĂ©mi Denis-Courmont <remi at remlab.net>
>
> ---
> src/misc/threads.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/src/misc/threads.c b/src/misc/threads.c
> index a44edb0727..46c569fff0 100644
> --- a/src/misc/threads.c
> +++ b/src/misc/threads.c
> @@ -157,8 +157,6 @@ bool vlc_mutex_held(const vlc_mutex_t *mtx)
>
> void vlc_mutex_lock(vlc_mutex_t *mtx)
> {
> - unsigned value;
> -
> /* This is the Drepper (non-recursive) mutex algorithm
> * from his "Futexes are tricky" paper. The mutex can value be:
> * - 0: the mutex is free
> @@ -170,8 +168,7 @@ void vlc_mutex_lock(vlc_mutex_t *mtx)
>
> int canc = vlc_savecancel(); /* locking is never a cancellation point */
>
> - while ((value = atomic_exchange_explicit(&mtx->value, 2,
> - memory_order_acquire)) != 0)
> + while (atomic_exchange_explicit(&mtx->value, 2, memory_order_acquire))
> vlc_atomic_wait(&mtx->value, 2);
>
> vlc_restorecancel(canc);
> --
> 2.30.0
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
>
More information about the vlc-devel
mailing list