]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
* cancellation.c (__pthread_disable_asynccancel): Use THREAD_ATOMIC_AND
authorUlrich Drepper <drepper@redhat.com>
Mon, 27 Apr 2009 21:55:49 +0000 (21:55 +0000)
committerUlrich Drepper <drepper@redhat.com>
Mon, 27 Apr 2009 21:55:49 +0000 (21:55 +0000)
is available.
* libc-cancellation.c (__libc_disable_asynccancel): Likewise.
* sysdeps/x86_64/tls.h: Define THREAD_ATOMIC_AND.
* sysdeps/i386/tls.h: Likewise.
(tcbhead_t): Add __private_tm member.

nptl/ChangeLog
nptl/cancellation.c
nptl/libc-cancellation.c
nptl/sysdeps/i386/tls.h
nptl/sysdeps/x86_64/tls.h

index 838a01003433781a7d8b6dfcd34716eb857a4811..54aa54637a5707e193b36f50e68bc56682453a9b 100644 (file)
@@ -1,3 +1,12 @@
+2009-04-27  Ulrich Drepper  <drepper@redhat.com>
+
+       * cancellation.c (__pthread_disable_asynccancel): Use THREAD_ATOMIC_AND
+       is available.
+       * libc-cancellation.c (__libc_disable_asynccancel): Likewise.
+       * sysdeps/x86_64/tls.h: Define THREAD_ATOMIC_AND.
+       * sysdeps/i386/tls.h: Likewise.
+       (tcbhead_t): Add __private_tm member.
+
 2009-04-26  Ulrich Drepper  <drepper@redhat.com>
 
        * sem_open.c (sem_open): Rewrite initialization of initsem to
index 1d28d383f9badafe75ee32e57a4d23bc8e306ae7..81134a679a90f7b3b552d6155a8e5059f44edd02 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -70,6 +70,10 @@ __pthread_disable_asynccancel (int oldtype)
     return;
 
   struct pthread *self = THREAD_SELF;
+
+#ifdef THREAD_ATOMIC_AND
+  THREAD_ATOMIC_AND (self, cancelhandling, ~CANCELTYPE_BITMASK);
+#else
   int oldval = THREAD_GETMEM (self, cancelhandling);
 
   while (1)
@@ -87,4 +91,5 @@ __pthread_disable_asynccancel (int oldtype)
       /* Prepare the next round.  */
       oldval = curval;
     }
+#endif
 }
index b88a32fefd0fad2e1d3ad5b9028c064b1c739d2d..cf24f1c0f2171c2ab993e878e59f1445a62e5cb3 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2005, 2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -86,6 +86,10 @@ __libc_disable_asynccancel (int oldtype)
     return;
 
   struct pthread *self = THREAD_SELF;
+
+#ifdef THREAD_ATOMIC_AND
+  THREAD_ATOMIC_AND (self, cancelhandling, ~CANCELTYPE_BITMASK);
+#else
   int oldval = THREAD_GETMEM (self, cancelhandling);
 
   while (1)
@@ -103,6 +107,7 @@ __libc_disable_asynccancel (int oldtype)
       /* Prepare the next round.  */
       oldval = curval;
     }
+#endif
 }
 
 
index b5127420cff3552f80df2533580f2459e9bbc07d..f23977e73f24201829ee685ff96ea558d3c8f100 100644 (file)
@@ -1,5 +1,5 @@
 /* Definition for thread-local data handling.  nptl/i386 version.
-   Copyright (C) 2002,2003,2004,2005,2006,2007 Free Software Foundation, Inc.
+   Copyright (C) 2002-2007, 2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -56,7 +56,11 @@ typedef struct
   int gscope_flag;
 #ifndef __ASSUME_PRIVATE_FUTEX
   int private_futex;
+#else
+  int __unused1;
 #endif
+  /* Reservation of some values for the TM ABI.  */
+  void *__private_tm[5];
 } tcbhead_t;
 
 # define TLS_MULTIPLE_THREADS_IN_TCB 1
@@ -394,6 +398,17 @@ union user_desc_init
      __ret; })
 
 
+/* Atomic logical and.  */
+#define THREAD_ATOMIC_AND(descr, member, val) \
+  (void) ({ if (sizeof ((descr)->member) == 4)                               \
+             asm volatile (LOCK_PREFIX "andl %1, %%gs:%P0"                   \
+                           :: "i" (offsetof (struct pthread, member)),       \
+                              "ir" (val));                                   \
+           else                                                              \
+             /* Not necessary for other sizes in the moment.  */             \
+             abort (); })
+
+
 /* Atomic set bit.  */
 #define THREAD_ATOMIC_BIT_SET(descr, member, bit) \
   (void) ({ if (sizeof ((descr)->member) == 4)                               \
index 172f44579bfabee224676f2fa92010646d41ba52..ea89f3b1a29f5a8b89ea5211c21ccca7e362acef 100644 (file)
@@ -1,5 +1,5 @@
 /* Definition for thread-local data handling.  nptl/x86_64 version.
-   Copyright (C) 2002-2007, 2008 Free Software Foundation, Inc.
+   Copyright (C) 2002-2007, 2008, 2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -312,6 +312,17 @@ typedef struct
      __ret; })
 
 
+/* Atomic logical and.  */
+#define THREAD_ATOMIC_AND(descr, member, val) \
+  (void) ({ if (sizeof ((descr)->member) == 4)                               \
+             asm volatile (LOCK_PREFIX "andl %1, %%fs:%P0"                   \
+                           :: "i" (offsetof (struct pthread, member)),       \
+                              "ir" (val));                                   \
+           else                                                              \
+             /* Not necessary for other sizes in the moment.  */             \
+             abort (); })
+
+
 /* Atomic set bit.  */
 #define THREAD_ATOMIC_BIT_SET(descr, member, bit) \
   (void) ({ if (sizeof ((descr)->member) == 4)                               \