1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-08 17:42:12 +03:00

nptl: Make pthread_attr_t dynamically extensible

This introduces the function __pthread_attr_extension to allocate the
extension space, which is freed by pthread_attr_destroy.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
This commit is contained in:
Florian Weimer
2020-06-02 10:33:30 +02:00
parent 6993670b52
commit 7538d46113
10 changed files with 98 additions and 33 deletions

View File

@@ -30,12 +30,16 @@ __pthread_attr_destroy (pthread_attr_t *attr)
iattr = (struct pthread_attr *) attr;
#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_1)
/* In old struct pthread_attr, neither next nor cpuset are
present. */
/* In old struct pthread_attr, the extension member is missing. */
if (__builtin_expect ((iattr->flags & ATTR_FLAG_OLDATTR), 0) == 0)
#endif
/* The affinity CPU set might be allocated dynamically. */
free (iattr->cpuset);
{
if (iattr->extension != NULL)
{
free (iattr->extension->cpuset);
free (iattr->extension);
}
}
return 0;
}