set explicit scheduling for new thread from calling thread, not self
authorRich Felker <dalias@aerifal.cx>
Fri, 6 Sep 2019 19:26:44 +0000 (15:26 -0400)
committerRich Felker <dalias@aerifal.cx>
Fri, 6 Sep 2019 19:54:32 +0000 (15:54 -0400)
commit022f27d541af68f047d367ad9d93f941135555c1
treebbbacf567535f3be44c3c15e934b575404a118ed
parentdd0a23dd9e157624347fdcc9dca452675b93da70
set explicit scheduling for new thread from calling thread, not self

if setting scheduling properties succeeds, the new thread may end up
with lower priority than the caller, and may be unable to continue
running due to another intermediate-priority thread. this produces a
priority inversion situation for the thread calling pthread_create,
since it cannot return until the new thread reports success.

originally, the parent was responsible for setting the new thread's
priority; commits b8742f32602add243ee2ce74d804015463726899 and
40bae2d32fd6f3ffea437fa745ad38a1fe77b27e changed it as part of
trimming down the pthread structure. since then, commit
04335d9260c076cf4d9264bd93dd3b06c237a639 partly reversed the changes,
but did not switch responsibilities back. do that now.
src/thread/pthread_create.c