about summary refs log tree commit diff
path: root/nptl/sysdeps/unix/sysv/linux/ia64/pthread_once.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-03-18 05:31:53 +0000
committerUlrich Drepper <drepper@redhat.com>2003-03-18 05:31:53 +0000
commit4773086e0498c99ee11422fc39606e9a53f12502 (patch)
tree3fe27fef04df3b0f2fd09d99898d5e412266e86a /nptl/sysdeps/unix/sysv/linux/ia64/pthread_once.c
parent970269474a7a5c5fe515adc6d55aeb2a796b73dd (diff)
downloadglibc-4773086e0498c99ee11422fc39606e9a53f12502.tar.gz
glibc-4773086e0498c99ee11422fc39606e9a53f12502.tar.xz
glibc-4773086e0498c99ee11422fc39606e9a53f12502.zip
Update.
	* sysdeps/unix/sysv/linux/ia64/pthread_once.c: Use __builtin_expect.
	Use __lll_add instead of spelling it out.  Use protected symbol names.
	* sysdeps/unix/sysv/linux/ia64/sem_post.c: Use __builtin_expect.
	Use __lll_add.
	* sysdeps/unix/sysv/linux/ia64/lowlevellock.h (__lll_compare_and_swap):
	Renamed from lll_compare_and_swap.  Use new name where necessary.
	(__lll_add): Defined.
	(__lll_dec_if_positive): Defined.
	(__lll_test_and_set): Defined.
	* sysdeps/ia64/pthread_spin_init.c: Removed.
	* sysdeps/unix/sysv/linux/ia64/lowlevelmutex.c: Removed.
	* sysdeps/unix/sysv/linux/ia64/sem_trywait.c: Removed.
	* sysdeps/unix/sysv/linux/ia64/sem_wait.c: Removed.
	* sysdeps/unix/sysv/linux/ia64/lowlevellock.c: Removed.
	* sysdeps/unix/sysv/linux/ia64/libc-lowlevellock.c: Removed.
	* sysdeps/unix/sysv/linux/ia64/libc-lowlevelmutex.c: Removed.
	* sysdeps/unix/sysv/linux/ia64/sem_timedwait.c: Removed.
Diffstat (limited to 'nptl/sysdeps/unix/sysv/linux/ia64/pthread_once.c')
-rw-r--r--nptl/sysdeps/unix/sysv/linux/ia64/pthread_once.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/nptl/sysdeps/unix/sysv/linux/ia64/pthread_once.c b/nptl/sysdeps/unix/sysv/linux/ia64/pthread_once.c
index e5cb6132d9..2f671fac41 100644
--- a/nptl/sysdeps/unix/sysv/linux/ia64/pthread_once.c
+++ b/nptl/sysdeps/unix/sysv/linux/ia64/pthread_once.c
@@ -52,10 +52,10 @@ __pthread_once (once_control, init_routine)
 
 	  oldval = val;
 	  newval = (oldval & 3) | __fork_generation | 1;
+	  val = __lll_compare_and_swap (once_control, oldval, newval);
 	}
-      while ((val = lll_compare_and_swap (once_control, oldval, newval))
-	     != oldval);
-      
+      while (__builtin_expect (val != oldval, 0));
+
       /* Check if another thread already runs the initializer.	*/
       if ((oldval & 1) != 0)
 	{
@@ -80,11 +80,7 @@ __pthread_once (once_control, init_routine)
 
 
       /* Add one to *once_control.  */
-      val = *once_control;
-      do
-	oldval = val;
-      while ((val = lll_compare_and_swap (once_control, oldval, oldval + 1))
-	     != oldval);
+      __lll_add (once_control, 1);
 
       /* Wake up all other threads.  */
       lll_futex_wake (once_control, INT_MAX);