about summary refs log tree commit diff
path: root/nptl/pthread_attr_destroy.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-07-20 08:56:05 +0000
committerUlrich Drepper <drepper@redhat.com>2003-07-20 08:56:05 +0000
commit80f536dbf20510cbabdb042c30baa453d0b069c1 (patch)
tree63be8c7d248de20158ef492570d1b18b55a0cf40 /nptl/pthread_attr_destroy.c
parent4e0dc4af0b279a659b94d66beb1397eb473af7d2 (diff)
downloadglibc-80f536dbf20510cbabdb042c30baa453d0b069c1.tar.gz
glibc-80f536dbf20510cbabdb042c30baa453d0b069c1.tar.xz
glibc-80f536dbf20510cbabdb042c30baa453d0b069c1.zip
Update.
2003-07-20  Ulrich Drepper  <drepper@redhat.com>

	* 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.
Diffstat (limited to 'nptl/pthread_attr_destroy.c')
-rw-r--r--nptl/pthread_attr_destroy.c14
1 files changed, 9 insertions, 5 deletions
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 <drepper@redhat.com>, 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)