mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-01 10:06:57 +03:00
* sysdeps/unix/sysv/linux/internaltypes.h (struct pthread_barrier):
Add private field. * sysdeps/unix/sysv/linux/lowlevelbarrier.sym: Add PRIVATE definition. * pthread_barrier_init.c: Set private flag if pshared and private futexes are supported. * sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S: Use private field in futex command setup. * sysdeps/unix/sysv/linux/x86_64/pthread_barrier_wait.S: Likewise.
This commit is contained in:
@ -1,3 +1,14 @@
|
|||||||
|
2007-05-26 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
* sysdeps/unix/sysv/linux/internaltypes.h (struct pthread_barrier):
|
||||||
|
Add private field.
|
||||||
|
* sysdeps/unix/sysv/linux/lowlevelbarrier.sym: Add PRIVATE definition.
|
||||||
|
* pthread_barrier_init.c: Set private flag if pshared and private
|
||||||
|
futexes are supported.
|
||||||
|
* sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S: Use
|
||||||
|
private field in futex command setup.
|
||||||
|
* sysdeps/unix/sysv/linux/x86_64/pthread_barrier_wait.S: Likewise.
|
||||||
|
|
||||||
2007-05-25 Ulrich Drepper <drepper@redhat.com>
|
2007-05-25 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
* sysdeps/unix/sysv/linux/i386/i486/sem_post.S: Add private futex
|
* sysdeps/unix/sysv/linux/i386/i486/sem_post.S: Add private futex
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 2002 Free Software Foundation, Inc.
|
/* Copyright (C) 2002, 2007 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
|
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
|
||||||
|
|
||||||
@ -20,6 +20,13 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include "pthreadP.h"
|
#include "pthreadP.h"
|
||||||
#include <lowlevellock.h>
|
#include <lowlevellock.h>
|
||||||
|
#include <kernel-features.h>
|
||||||
|
|
||||||
|
|
||||||
|
static const struct pthread_barrierattr default_attr =
|
||||||
|
{
|
||||||
|
.pshared = PTHREAD_PROCESS_PRIVATE
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -33,17 +40,15 @@ pthread_barrier_init (barrier, attr, count)
|
|||||||
if (__builtin_expect (count == 0, 0))
|
if (__builtin_expect (count == 0, 0))
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
|
||||||
if (attr != NULL)
|
struct pthread_barrierattr *iattr
|
||||||
{
|
= (attr != NULL
|
||||||
struct pthread_barrierattr *iattr;
|
? iattr = (struct pthread_barrierattr *) attr
|
||||||
|
: &default_attr);
|
||||||
|
|
||||||
iattr = (struct pthread_barrierattr *) attr;
|
if (iattr->pshared != PTHREAD_PROCESS_PRIVATE
|
||||||
|
&& __builtin_expect (iattr->pshared != PTHREAD_PROCESS_SHARED, 0))
|
||||||
if (iattr->pshared != PTHREAD_PROCESS_PRIVATE
|
/* Invalid attribute. */
|
||||||
&& __builtin_expect (iattr->pshared != PTHREAD_PROCESS_SHARED, 0))
|
return EINVAL;
|
||||||
/* Invalid attribute. */
|
|
||||||
return EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
ibarrier = (struct pthread_barrier *) barrier;
|
ibarrier = (struct pthread_barrier *) barrier;
|
||||||
|
|
||||||
@ -53,5 +58,14 @@ pthread_barrier_init (barrier, attr, count)
|
|||||||
ibarrier->init_count = count;
|
ibarrier->init_count = count;
|
||||||
ibarrier->curr_event = 0;
|
ibarrier->curr_event = 0;
|
||||||
|
|
||||||
|
#ifdef __ASSUME_PRIVATE_FUTEX
|
||||||
|
ibarrier->private = (iattr->pshared != PTHREAD_PROCESS_PRIVATE
|
||||||
|
? 0 : FUTEX_PRIVATE_FLAG);
|
||||||
|
#else
|
||||||
|
ibarrier->private = (iattr->pshared != PTHREAD_PROCESS_PRIVATE
|
||||||
|
? 0 : THREAD_GETMEM (THREAD_SELF,
|
||||||
|
header.private_futex));
|
||||||
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
|
/* Copyright (C) 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
|
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
|
||||||
|
|
||||||
@ -69,7 +69,13 @@ pthread_barrier_wait:
|
|||||||
|
|
||||||
/* Wait for the remaining threads. The call will return immediately
|
/* Wait for the remaining threads. The call will return immediately
|
||||||
if the CURR_EVENT memory has meanwhile been changed. */
|
if the CURR_EVENT memory has meanwhile been changed. */
|
||||||
7: xorl %ecx, %ecx /* movl $FUTEX_WAIT, %ecx */
|
7:
|
||||||
|
#if FUTEX_WAIT == 0
|
||||||
|
movl PRIVATE(%ebx), %ecx
|
||||||
|
#else
|
||||||
|
movl $FUTEX_WAIT, %ecx
|
||||||
|
orl PRIVATE(%ebx), %ecx
|
||||||
|
#endif
|
||||||
xorl %esi, %esi
|
xorl %esi, %esi
|
||||||
8: movl $SYS_futex, %eax
|
8: movl $SYS_futex, %eax
|
||||||
ENTER_KERNEL
|
ENTER_KERNEL
|
||||||
@ -120,6 +126,7 @@ pthread_barrier_wait:
|
|||||||
so 0x7fffffff is the highest value. */
|
so 0x7fffffff is the highest value. */
|
||||||
movl $0x7fffffff, %edx
|
movl $0x7fffffff, %edx
|
||||||
movl $FUTEX_WAKE, %ecx
|
movl $FUTEX_WAKE, %ecx
|
||||||
|
orl PRIVATE(%ebx), %ecx
|
||||||
movl $SYS_futex, %eax
|
movl $SYS_futex, %eax
|
||||||
ENTER_KERNEL
|
ENTER_KERNEL
|
||||||
|
|
||||||
|
@ -96,6 +96,7 @@ struct pthread_barrier
|
|||||||
int lock;
|
int lock;
|
||||||
unsigned int left;
|
unsigned int left;
|
||||||
unsigned int init_count;
|
unsigned int init_count;
|
||||||
|
int private;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,3 +9,4 @@ CURR_EVENT offsetof (struct pthread_barrier, curr_event)
|
|||||||
MUTEX offsetof (struct pthread_barrier, lock)
|
MUTEX offsetof (struct pthread_barrier, lock)
|
||||||
LEFT offsetof (struct pthread_barrier, left)
|
LEFT offsetof (struct pthread_barrier, left)
|
||||||
INIT_COUNT offsetof (struct pthread_barrier, init_count)
|
INIT_COUNT offsetof (struct pthread_barrier, init_count)
|
||||||
|
PRIVATE offsetof (struct pthread_barrier, private)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
|
/* Copyright (C) 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
|
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
|
||||||
|
|
||||||
@ -65,9 +65,10 @@ pthread_barrier_wait:
|
|||||||
if the CURR_EVENT memory has meanwhile been changed. */
|
if the CURR_EVENT memory has meanwhile been changed. */
|
||||||
7:
|
7:
|
||||||
#if FUTEX_WAIT == 0
|
#if FUTEX_WAIT == 0
|
||||||
xorl %esi, %esi
|
movl PRIVATE(%rdi), %esi
|
||||||
#else
|
#else
|
||||||
movl $FUTEX_WAIT, %esi
|
movl $FUTEX_WAIT, %esi
|
||||||
|
orl PRIVATE(%rdi), %esi
|
||||||
#endif
|
#endif
|
||||||
xorq %r10, %r10
|
xorq %r10, %r10
|
||||||
8: movl $SYS_futex, %eax
|
8: movl $SYS_futex, %eax
|
||||||
@ -116,6 +117,7 @@ pthread_barrier_wait:
|
|||||||
so 0x7fffffff is the highest value. */
|
so 0x7fffffff is the highest value. */
|
||||||
movl $0x7fffffff, %edx
|
movl $0x7fffffff, %edx
|
||||||
movl $FUTEX_WAKE, %esi
|
movl $FUTEX_WAKE, %esi
|
||||||
|
orl PRIVATE(%rdi), %esi
|
||||||
movl $SYS_futex, %eax
|
movl $SYS_futex, %eax
|
||||||
syscall
|
syscall
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user