From 80f536dbf20510cbabdb042c30baa453d0b069c1 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sun, 20 Jul 2003 08:56:05 +0000 Subject: Update. 2003-07-20 Ulrich Drepper * Makefile (libpthread-routines): Add pthread_attr_getaffinity and pthread_attr_setaffinity. * Versions [libpthread] (GLIBC_2.3.3): Likewise. * sysdeps/unix/sysv/linux/pthread_attr_getaffinity.c: New file. * sysdeps/unix/sysv/linux/pthread_attr_setaffinity.c: New file. * pthread_attr_destroy.c: Free cpuset element if allocated. * pthread_create.c: Pass iattr as additional parameter to create_thread. * sysdeps/pthread/createthread.c: If attribute is provided and a new thread is created with affinity set or scheduling parameters, start thread with CLONE_STOPPED. * sysdeps/pthread/pthread.h: Declare pthread_attr_getaffinity and pthread_attr_setaffinity. * sysdeps/unix/sysv/linux/internaltypes.h (struct pthread_attr): Add cpuset element. --- nptl/pthread_attr_destroy.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'nptl/pthread_attr_destroy.c') diff --git a/nptl/pthread_attr_destroy.c b/nptl/pthread_attr_destroy.c index fec04163b1..a04f5fe441 100644 --- a/nptl/pthread_attr_destroy.c +++ b/nptl/pthread_attr_destroy.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 2002. @@ -28,16 +28,17 @@ int __pthread_attr_destroy (attr) pthread_attr_t *attr; { + struct pthread_attr *iattr; + + assert (sizeof (*attr) >= sizeof (struct pthread_attr)); + iattr = (struct pthread_attr *) attr; + /* Enqueue the attributes to the list of all known variables. */ if (DEBUGGING_P) { - struct pthread_attr *iattr; struct pthread_attr *prevp = NULL; struct pthread_attr *runp; - assert (sizeof (*attr) >= sizeof (struct pthread_attr)); - iattr = (struct pthread_attr *) attr; - lll_lock (__attr_list_lock); runp = __attr_list; @@ -62,6 +63,9 @@ __pthread_attr_destroy (attr) return EINVAL; } + /* The affinity CPU set might be allocated dynamically. */ + free (iattr->cpuset); + return 0; } strong_alias (__pthread_attr_destroy, pthread_attr_destroy) -- cgit 1.4.1