summaryrefslogtreecommitdiff
path: root/nptl
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2006-04-27 21:29:55 +0000
committerJakub Jelinek <jakub@redhat.com>2006-04-27 21:29:55 +0000
commit0ad70fc14340d1e3ac2976014766c6eb6d5d3715 (patch)
tree31c5833023f6399a6bada4016306a5a417461ed7 /nptl
parent9b356005b4dca9c57af7cb1f5313a13a728c6310 (diff)
Updated to fedora-glibc-20060427T2122
Diffstat (limited to 'nptl')
-rw-r--r--nptl/ChangeLog10
-rw-r--r--nptl/sysdeps/unix/sysv/linux/timer_routines.c36
-rw-r--r--nptl/sysdeps/x86_64/tls.h4
3 files changed, 41 insertions, 9 deletions
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index 2418fa8106..41a1d7f594 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,13 @@
+2006-04-27 Ulrich Drepper <drepper@redhat.com>
+
+ * sysdeps/unix/sysv/linux/timer_routines.c (timer_helper_thread):
+ Allocate new object which is passed to timer_sigev_thread so that
+ the timer can be deleted before the new thread is scheduled.
+
+2006-04-26 Roland McGrath <roland@redhat.com>
+
+ * sysdeps/x86_64/tls.h: Include <asm/prctl.h> inside [! __ASSEMBLER__].
+
2006-04-08 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/i386/lowlevellock.h: Remove branch predicion
diff --git a/nptl/sysdeps/unix/sysv/linux/timer_routines.c b/nptl/sysdeps/unix/sysv/linux/timer_routines.c
index c180b27c96..a5eb442251 100644
--- a/nptl/sysdeps/unix/sysv/linux/timer_routines.c
+++ b/nptl/sysdeps/unix/sysv/linux/timer_routines.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
@@ -27,6 +27,13 @@
#include "kernel-posix-timers.h"
+struct thread_start_data
+{
+ void (*thrfunc) (sigval_t);
+ sigval_t sival;
+};
+
+
#ifdef __NR_timer_create
/* Helper thread to call the user-provided function. */
static void *
@@ -40,10 +47,16 @@ timer_sigev_thread (void *arg)
INTERNAL_SYSCALL_DECL (err);
INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_SETMASK, &ss, NULL, _NSIG / 8);
- struct timer *tk = (struct timer *) arg;
+ struct thread_start_data *td = (struct thread_start_data *) arg;
+
+ void (*thrfunc) (sigval_t) = td->thrfunc;
+ sigval_t sival = td->sival;
+
+ /* The TD object was allocated in timer_helper_thread. */
+ free (td);
/* Call the user-provided function. */
- tk->thrfunc (tk->sival);
+ thrfunc (sival);
return NULL;
}
@@ -82,10 +95,19 @@ timer_helper_thread (void *arg)
if (si.si_code == SI_TIMER)
{
struct timer *tk = (struct timer *) si.si_ptr;
-
- /* That the signal we are waiting for. */
- pthread_t th;
- (void) pthread_create (&th, &tk->attr, timer_sigev_thread, tk);
+ struct thread_start_data *td = malloc (sizeof (*td));
+
+ /* There is not much we can do if the allocation fails. */
+ if (td != NULL)
+ {
+ /* That is the signal we are waiting for. */
+ td->thrfunc = tk->thrfunc;
+ td->sival = tk->sival;
+
+ pthread_t th;
+ (void) pthread_create (&th, &tk->attr, timer_sigev_thread,
+ td);
+ }
}
else if (si.si_code == SI_TKILL)
/* The thread is canceled. */
diff --git a/nptl/sysdeps/x86_64/tls.h b/nptl/sysdeps/x86_64/tls.h
index 13cf6fb3f5..65ff0639b6 100644
--- a/nptl/sysdeps/x86_64/tls.h
+++ b/nptl/sysdeps/x86_64/tls.h
@@ -1,5 +1,5 @@
/* Definition for thread-local data handling. nptl/x86_64 version.
- Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004, 2005, 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,8 +20,8 @@
#ifndef _TLS_H
#define _TLS_H 1
-#include <asm/prctl.h> /* For ARCH_SET_FS. */
#ifndef __ASSEMBLER__
+# include <asm/prctl.h> /* For ARCH_SET_FS. */
# include <stdbool.h>
# include <stddef.h>
# include <stdint.h>