[PATCH] nptl: Effectively skip CAS in spinlock loop

Andreas Schwab schwab@linux-m68k.org
Mon Dec 13 14:42:04 GMT 2021


On Dez 06 2021, Jangwoong Kim via Libc-alpha wrote:

> @@ -148,8 +148,9 @@ PTHREAD_MUTEX_LOCK (pthread_mutex_t *mutex)
>  	      atomic_spin_nop ();
>  	      if (LLL_MUTEX_READ_LOCK (mutex) != 0)
>  		continue;
> +	      if (LLL_MUTEX_TRYLOCK (mutex) == 0)
> +		break;

Please combine the two conditions to make it a less confusing control flow.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."


More information about the Libc-alpha mailing list