From 02abf91ce4879ac0333511fb49201a283c0b2610 Mon Sep 17 00:00:00 2001 From: Pavel <68122101+red-prig@users.noreply.github.com> Date: Wed, 27 Nov 2024 19:41:39 +0300 Subject: [PATCH] + --- sys/kern/kern_umtx.pas | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/sys/kern/kern_umtx.pas b/sys/kern/kern_umtx.pas index 5a699c6e..2d37e10e 100644 --- a/sys/kern/kern_umtx.pas +++ b/sys/kern/kern_umtx.pas @@ -2158,6 +2158,7 @@ end; function do_unlock_pi(td:p_kthread;m:p_umutex;flags:Integer):Integer; var + uq_thread:p_kthread; key:umtx_key; uq_first,uq_first2,uq_me:p_umtx_q; pi,pi2:p_umtx_pi; @@ -2284,19 +2285,21 @@ begin umtxq_unlock(@key); end else begin - id:=uq_first^.uq_thread^.td_tid; + uq_thread:=uq_first^.uq_thread; + id:=uq_thread^.td_tid; if ((flags and $200) <> 0) then begin mtx_lock(umtx_lock); + pi:=uq_first^.uq_pi_blocked; + Assert(pi<>nil,'pi=nil?'); + uq_first^.uq_pi_blocked:=nil; - thread_lock(uq_first^.uq_thread); - uq_first^.uq_thread^.td_flags:=uq_first^.uq_thread^.td_flags and (not TDF_UPIBLOCKED); - thread_unlock(uq_first^.uq_thread); - - pi:=uq_first^.uq_pi_blocked; + thread_lock(uq_thread); + uq_thread^.td_flags:=uq_thread^.td_flags and (not TDF_UPIBLOCKED); + thread_unlock(uq_thread); TAILQ_REMOVE(@pi^.pi_blocked, uq_first, @uq_first^.uq_lockq); @@ -2306,7 +2309,7 @@ begin if (count > 1) then begin - Result:=umtx_pi_claim(pi, uq_first^.uq_thread); + Result:=umtx_pi_claim(pi, uq_thread); if (Result <> 0) then begin