diff options
author | Florian Weimer <fweimer@redhat.com> | 2020-06-02 10:33:30 +0200 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2020-06-02 11:54:58 +0200 |
commit | 7538d461134bf306e31b40e4032f0c225bb40d51 (patch) | |
tree | 34c4ceb7c6565864dfc62d8e23dd8f37e24944af /sysdeps/unix | |
parent | 6993670b52daa413717e840dfb17b5322e7f4a88 (diff) | |
download | glibc-7538d461134bf306e31b40e4032f0c225bb40d51.tar glibc-7538d461134bf306e31b40e4032f0c225bb40d51.tar.gz glibc-7538d461134bf306e31b40e4032f0c225bb40d51.tar.bz2 glibc-7538d461134bf306e31b40e4032f0c225bb40d51.zip |
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>
Diffstat (limited to 'sysdeps/unix')
-rw-r--r-- | sysdeps/unix/sysv/linux/createthread.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sysdeps/unix/sysv/linux/createthread.c b/sysdeps/unix/sysv/linux/createthread.c index 21f9d24f2d..6588893ba5 100644 --- a/sysdeps/unix/sysv/linux/createthread.c +++ b/sysdeps/unix/sysv/linux/createthread.c @@ -52,8 +52,10 @@ create_thread (struct pthread *pd, const struct pthread_attr *attr, /* Determine whether the newly created threads has to be started stopped since we have to set the scheduling parameters or set the affinity. */ + bool need_setaffinity = (attr != NULL && attr->extension != NULL + && attr->extension->cpuset != 0); if (attr != NULL - && (__glibc_unlikely (attr->cpuset != NULL) + && (__glibc_unlikely (need_setaffinity) || __glibc_unlikely ((attr->flags & ATTR_FLAG_NOTINHERITSCHED) != 0))) *stopped_start = true; @@ -113,12 +115,13 @@ create_thread (struct pthread *pd, const struct pthread_attr *attr, int res; /* Set the affinity mask if necessary. */ - if (attr->cpuset != NULL) + if (need_setaffinity) { assert (*stopped_start); res = INTERNAL_SYSCALL_CALL (sched_setaffinity, pd->tid, - attr->cpusetsize, attr->cpuset); + attr->extension->cpusetsize, + attr->extension->cpuset); if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (res))) err_out: |