From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2201) id 06B5C3856089; Tue, 18 Jul 2023 13:19:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 06B5C3856089 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1689686397; bh=X+Ix1okgjI2Nxf/uCNij2pGucfVP6PJBqVIKDcGzQzU=; h=From:To:Subject:Date:From; b=WVRKMXfI+ltlIeWpD6CdlGCoJg9f8j7vF6gXalBkfMf91owaM6nCviSsBQXJsaYMe azn6XaPg9A/E1LJTEK4lxu58Ufeq7XlrrnzCvOyNrVn18VhrHtEOs6moqIiK/IfgBL Gg/h7Gwvl+tjIGBl6SkbEO26KEfjSMMa+QEgXKQA= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Jon Turney To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: pthread: Take note of schedparam in pthread_create X-Act-Checkin: newlib-cygwin X-Git-Author: Jon Turney X-Git-Refname: refs/heads/master X-Git-Oldrev: 661f9f9c5a1e6f8fa74d450ee8273d6d1f30c5b2 X-Git-Newrev: c431f6b7fe11edc1e1cb1a8aec1205ca1713402b Message-Id: <20230718131957.06B5C3856089@sourceware.org> Date: Tue, 18 Jul 2023 13:19:57 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3Dc431f6b7fe1= 1edc1e1cb1a8aec1205ca1713402b commit c431f6b7fe11edc1e1cb1a8aec1205ca1713402b Author: Jon Turney Date: Thu Jul 6 16:39:13 2023 +0100 Cygwin: pthread: Take note of schedparam in pthread_create =20 Take note of schedparam in any pthread_attr_t passed to pthread_create. =20 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. =20 (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.) =20 Fixes testcase priority2. =20 Signed-off-by: Jon Turney Diff: --- winsup/cygwin/thread.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/winsup/cygwin/thread.cc b/winsup/cygwin/thread.cc index f614e01c4..afddf4282 100644 --- a/winsup/cygwin/thread.cc +++ b/winsup/cygwin/thread.cc @@ -457,6 +457,7 @@ pthread::precreate (pthread_attr *newattr) attr.joinable =3D newattr->joinable; attr.contentionscope =3D newattr->contentionscope; attr.inheritsched =3D newattr->inheritsched; + attr.schedparam =3D newattr->schedparam; attr.stackaddr =3D newattr->stackaddr; attr.stacksize =3D newattr->stacksize; attr.guardsize =3D newattr->guardsize;