]> sourceware.org Git - newlib-cygwin.git/commitdiff
Cygwin: pthread: Take note of schedparam in pthread_create
authorJon Turney <jon.turney@dronecode.org.uk>
Thu, 6 Jul 2023 15:39:13 +0000 (16:39 +0100)
committerJon Turney <jon.turney@dronecode.org.uk>
Tue, 18 Jul 2023 13:18:45 +0000 (14:18 +0100)
Take note of schedparam in any pthread_attr_t passed to pthread_create.

postcreate() (racily, after the thread is actually created), sets the
scheduling priority if it's inherited, but precreate() doesn't store any
scheduling priority explicitly set via a non-default attr to
pthread_create, so schedparam.sched_priority has the default value of 0.

(I think this is another long-standing bug exposed by 4b51e4c1.  Now we
don't lie about the actual thread priority, it's apparent it's not
really being set in this case.)

Fixes testcase priority2.

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
winsup/cygwin/thread.cc

index f614e01c42f6fd01a892462b5c18f1321ed4ec88..afddf42821adaee867ec5d4aae0f6d184119fc3f 100644 (file)
@@ -457,6 +457,7 @@ pthread::precreate (pthread_attr *newattr)
       attr.joinable = newattr->joinable;
       attr.contentionscope = newattr->contentionscope;
       attr.inheritsched = newattr->inheritsched;
+      attr.schedparam = newattr->schedparam;
       attr.stackaddr = newattr->stackaddr;
       attr.stacksize = newattr->stacksize;
       attr.guardsize = newattr->guardsize;
This page took 0.036934 seconds and 5 git commands to generate.