[Glibc-bsd-commits] r6082 - trunk/glibc-ports-2.24/kfreebsd/fbtl

aurel32 at alioth.debian.org aurel32 at alioth.debian.org
Wed Jul 6 21:18:54 UTC 2016


Author: aurel32
Date: 2016-07-06 21:18:54 +0000 (Wed, 06 Jul 2016)
New Revision: 6082

Modified:
   trunk/glibc-ports-2.24/kfreebsd/fbtl/sem_post.c
Log:
Port sem_post.c to the new C11-like atomic_compare_exchange_weak_release.


Modified: trunk/glibc-ports-2.24/kfreebsd/fbtl/sem_post.c
===================================================================
--- trunk/glibc-ports-2.24/kfreebsd/fbtl/sem_post.c	2016-07-06 21:18:21 UTC (rev 6081)
+++ trunk/glibc-ports-2.24/kfreebsd/fbtl/sem_post.c	2016-07-06 21:18:54 UTC (rev 6082)
@@ -31,17 +31,16 @@
 {
   struct new_sem *isem = (struct new_sem *) sem;
 
-  __typeof (isem->value) cur;
+  __typeof (isem->value) cur = atomic_load_relaxed(&isem->value);
   do
     {
-      cur = isem->value;
-      if (isem->value == SEM_VALUE_MAX)
+      if (cur == SEM_VALUE_MAX)
 	{
 	  __set_errno (EOVERFLOW);
 	  return -1;
 	}
     }
-  while (atomic_compare_and_exchange_bool_rel (&isem->value, cur + 1, cur));
+  while (!atomic_compare_exchange_weak_release(&isem->value, &cur, cur + 1));
 
   atomic_full_barrier ();
   if (isem->nwaiters > 0)




More information about the Glibc-bsd-commits mailing list