summaryrefslogtreecommitdiff
path: root/nptl
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2006-09-19 18:46:51 +0000
committerJakub Jelinek <jakub@redhat.com>2006-09-19 18:46:51 +0000
commit61d906ea3820eefbe91548b295a95f3bc26c45a2 (patch)
tree79398a8e14fbe36db2c44baf134c8edddcd2083d /nptl
parent3d6b6fbc1f374f55fdb9e277d7e851fe112d68ff (diff)
Updated to fedora-glibc-20060919T1816
Diffstat (limited to 'nptl')
-rw-r--r--nptl/ChangeLog16
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_broadcast.S8
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S18
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S18
-rw-r--r--nptl/tst-cancel2.c8
-rw-r--r--nptl/tst-kill4.c21
6 files changed, 77 insertions, 12 deletions
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index afa9a37c97..0d05e200ff 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,17 @@
+2006-09-18 Jakub Jelinek <jakub@redhat.com>
+
+ * tst-kill4.c (do_test): Explicitly set tf thread's stack size.
+
+ * tst-cancel2.c (tf): Loop as long as something was written.
+
+2006-09-12 Kaz Kojima <kkojima@rr.iij4u.or.jp>
+
+ * sysdeps/unix/sysv/linux/sh/pthread_cond_broadcast.S: For PI
+ mutexes wake all mutexes.
+ * sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S: Don't increment
+ WAKEUP_SEQ if this would increase the value beyond TOTAL_SEQ.
+ * sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S: Likewise.
+
2006-09-12 Ulrich Drepper <drepper@redhat.com>
* tst-cond22.c (tf): Slight changes to the pthread_cond_wait use
@@ -12,7 +26,7 @@
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S: Likewise.
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S: Likewise.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S: Likewise.
-
+
2006-09-08 Ulrich Drepper <drepper@redhat.com>
[BZ #3123]
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_broadcast.S b/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_broadcast.S
index 6bd6e60ec1..56f0aa95de 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_broadcast.S
+++ b/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_broadcast.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2006 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
@@ -20,6 +20,7 @@
#include <shlib-compat.h>
#include <lowlevelcond.h>
#include <kernel-features.h>
+#include <pthread-pi-defines.h>
#include "lowlevel-atomic.h"
#define SYS_futex 240
@@ -98,6 +99,11 @@ __pthread_cond_broadcast:
bt/s 9f
add #cond_futex, r4
+ /* XXX: The kernel so far doesn't support requeue to PI futex. */
+ mov.l @(MUTEX_KIND,r9), r0
+ tst #PI_BIT, r0
+ bf 9f
+
/* Wake up all threads. */
mov #FUTEX_CMP_REQUEUE, r5
mov #1, r6
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S b/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S
index 74206a71ec..6c782c8a76 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S
+++ b/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2006 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
@@ -521,6 +521,21 @@ __condvar_tw_cleanup:
mov #1, r2
mov #0, r3
+ /* We increment the wakeup_seq counter only if it is lower than
+ total_seq. If this is not the case the thread was woken and
+ then canceled. In this case we ignore the signal. */
+ mov.l @(total_seq+4,r8), r0
+ mov.l @(wakeup_seq+4,r8), r1
+ cmp/hi r1, r0
+ bt/s 6f
+ cmp/hi r0, r1
+ bt 7f
+ mov.l @(total_seq,r8), r0
+ mov.l @(wakeup_seq,r8), r1
+ cmp/hs r0, r1
+ bt 7f
+
+6:
clrt
mov.l @(wakeup_seq,r8),r0
mov.l @(wakeup_seq+4,r8),r1
@@ -532,6 +547,7 @@ __condvar_tw_cleanup:
add r2, r0
mov.l r0,@(cond_futex,r8)
+7:
clrt
mov.l @(woken_seq,r8),r0
mov.l @(woken_seq+4,r8),r1
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S b/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S
index 2d6b685668..6c59f3e6c0 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S
+++ b/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2006 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
@@ -385,6 +385,21 @@ __condvar_w_cleanup:
mov #1, r2
mov #0, r3
+ /* We increment the wakeup_seq counter only if it is lower than
+ total_seq. If this is not the case the thread was woken and
+ then canceled. In this case we ignore the signal. */
+ mov.l @(total_seq+4,r8), r0
+ mov.l @(wakeup_seq+4,r8), r1
+ cmp/hi r1, r0
+ bt/s 6f
+ cmp/hi r0, r1
+ bt 7f
+ mov.l @(total_seq,r8), r0
+ mov.l @(wakeup_seq,r8), r1
+ cmp/hs r0, r1
+ bt 7f
+
+6:
clrt
mov.l @(wakeup_seq,r8),r0
mov.l @(wakeup_seq+4,r8),r1
@@ -396,6 +411,7 @@ __condvar_w_cleanup:
add r2, r0
mov.l r0,@(cond_futex,r8)
+7:
clrt
mov.l @(woken_seq,r8),r0
mov.l @(woken_seq+4,r8),r1
diff --git a/nptl/tst-cancel2.c b/nptl/tst-cancel2.c
index 6d80f8ae5e..529b5d4050 100644
--- a/nptl/tst-cancel2.c
+++ b/nptl/tst-cancel2.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -33,11 +33,7 @@ tf (void *arg)
write blocks. */
char buf[100000];
- if (write (fd[1], buf, sizeof (buf)) == sizeof (buf))
- {
- puts ("write succeeded");
- return (void *) 1l;
- }
+ while (write (fd[1], buf, sizeof (buf)) > 0);
return (void *) 42l;
}
diff --git a/nptl/tst-kill4.c b/nptl/tst-kill4.c
index 4e7ff5eaf4..a1b97e7b26 100644
--- a/nptl/tst-kill4.c
+++ b/nptl/tst-kill4.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
@@ -35,13 +35,30 @@ tf (void *a)
int
do_test (void)
{
+ pthread_attr_t at;
+ if (pthread_attr_init (&at) != 0)
+ {
+ puts ("attr_create failed");
+ exit (1);
+ }
+
+ /* Limit thread stack size, because if it is too large, pthread_join
+ will free it immediately rather than put it into stack cache. */
+ if (pthread_attr_setstacksize (&at, 2 * 1024 * 1024) != 0)
+ {
+ puts ("setstacksize failed");
+ exit (1);
+ }
+
pthread_t th;
- if (pthread_create (&th, NULL, tf, NULL) != 0)
+ if (pthread_create (&th, &at, tf, NULL) != 0)
{
puts ("create failed");
exit (1);
}
+ pthread_attr_destroy (&at);
+
if (pthread_join (th, NULL) != 0)
{
puts ("join failed");