Cygwin: pthread: Take note of schedparam in pthread_create

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>
This commit is contained in:
Jon Turney 2023-07-06 16:39:13 +01:00
parent 661f9f9c5a
commit c431f6b7fe
No known key found for this signature in database
GPG Key ID: C7C86F0370285C81
1 changed files with 1 additions and 0 deletions

View File

@ -457,6 +457,7 @@ pthread::precreate (pthread_attr *newattr)
attr.joinable = newattr->joinable; attr.joinable = newattr->joinable;
attr.contentionscope = newattr->contentionscope; attr.contentionscope = newattr->contentionscope;
attr.inheritsched = newattr->inheritsched; attr.inheritsched = newattr->inheritsched;
attr.schedparam = newattr->schedparam;
attr.stackaddr = newattr->stackaddr; attr.stackaddr = newattr->stackaddr;
attr.stacksize = newattr->stacksize; attr.stacksize = newattr->stacksize;
attr.guardsize = newattr->guardsize; attr.guardsize = newattr->guardsize;