]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - nptl/pthread_timedjoin.c
Add per-thread cache to malloc
[thirdparty/glibc.git] / nptl / pthread_timedjoin.c
index c83c0ef9537843e0877de3c13d52ad317f8e18d1..567c171133c6aa94e910955fca4ba89da0983c72 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2017 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
    Lesser General Public License for more details.
 
    You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
 
 #include <errno.h>
 #include <stdlib.h>
-#include "atomic.h"
+#include <atomic.h>
 #include "pthreadP.h"
 
 
@@ -31,10 +30,8 @@ cleanup (void *arg)
 
 
 int
-pthread_timedjoin_np (threadid, thread_return, abstime)
-     pthread_t threadid;
-     void **thread_return;
-     const struct timespec *abstime;
+pthread_timedjoin_np (pthread_t threadid, void **thread_return,
+                     const struct timespec *abstime)
 {
   struct pthread *self;
   struct pthread *pd = (struct pthread *) threadid;
@@ -63,8 +60,8 @@ pthread_timedjoin_np (threadid, thread_return, abstime)
 
   /* Wait for the thread to finish.  If it is already locked something
      is wrong.  There can only be one waiter.  */
-  if (__builtin_expect (atomic_compare_and_exchange_acq (&pd->joinid, self,
-                                                        NULL) != 0, 0))
+  if (__builtin_expect (atomic_compare_and_exchange_bool_acq (&pd->joinid,
+                                                             self, NULL), 0))
     /* There is already somebody waiting for the thread.  */
     return EINVAL;