about summary refs log tree commit diff
path: root/nptl/pthread_create.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@hack.frob.com>2014-11-20 10:56:20 -0800
committerRoland McGrath <roland@hack.frob.com>2014-11-20 10:56:20 -0800
commitf214ff74f46275f6f1187730ac88b8a2407393f3 (patch)
treedbbb3206b1a977022e7c53920ad0744f530f8234 /nptl/pthread_create.c
parente37c91d4196f116d826cab129ca2637bd367b35e (diff)
downloadglibc-f214ff74f46275f6f1187730ac88b8a2407393f3.tar.gz
glibc-f214ff74f46275f6f1187730ac88b8a2407393f3.tar.xz
glibc-f214ff74f46275f6f1187730ac88b8a2407393f3.zip
NPTL: Refactor scheduler setup in pthread_create.
Diffstat (limited to 'nptl/pthread_create.c')
-rw-r--r--nptl/pthread_create.c21
1 files changed, 6 insertions, 15 deletions
diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c
index 1dd1b951c0..3d4b8cd94e 100644
--- a/nptl/pthread_create.c
+++ b/nptl/pthread_create.c
@@ -30,6 +30,7 @@
 #include <resolv.h>
 #include <kernel-features.h>
 #include <exit-thread.h>
+#include <default-sched.h>
 
 #include <shlib-compat.h>
 
@@ -593,26 +594,16 @@ __pthread_create_2_1 (newthread, attr, start_routine, arg)
   if (__builtin_expect ((iattr->flags & ATTR_FLAG_NOTINHERITSCHED) != 0, 0)
       && (iattr->flags & (ATTR_FLAG_SCHED_SET | ATTR_FLAG_POLICY_SET)) != 0)
     {
-      INTERNAL_SYSCALL_DECL (scerr);
-
       /* Use the scheduling parameters the user provided.  */
       if (iattr->flags & ATTR_FLAG_POLICY_SET)
 	pd->schedpolicy = iattr->schedpolicy;
-      else if ((pd->flags & ATTR_FLAG_POLICY_SET) == 0)
-	{
-	  pd->schedpolicy = INTERNAL_SYSCALL (sched_getscheduler, scerr, 1, 0);
-	  pd->flags |= ATTR_FLAG_POLICY_SET;
-	}
-
       if (iattr->flags & ATTR_FLAG_SCHED_SET)
         /* The values were validated in pthread_attr_setschedparam.  */
-	memcpy (&pd->schedparam, &iattr->schedparam,
-		sizeof (struct sched_param));
-      else if ((pd->flags & ATTR_FLAG_SCHED_SET) == 0)
-	{
-	  INTERNAL_SYSCALL (sched_getparam, scerr, 2, 0, &pd->schedparam);
-	  pd->flags |= ATTR_FLAG_SCHED_SET;
-	}
+        pd->schedparam = iattr->schedparam;
+
+      if ((pd->flags & (ATTR_FLAG_SCHED_SET | ATTR_FLAG_POLICY_SET))
+          != (ATTR_FLAG_SCHED_SET | ATTR_FLAG_POLICY_SET))
+        collect_default_sched (pd);
     }
 
   /* Pass the descriptor to the caller.  */