This commit is contained in:
Pavel 2023-03-03 16:16:10 +03:00
parent 7bdcf59ae9
commit 977c507293
8 changed files with 11 additions and 24 deletions

View File

@ -1,4 +1,4 @@
unit gtailq;
unit mqueue;
{$mode ObjFPC}{$H+}

View File

@ -6,7 +6,7 @@ unit kern_sig;
interface
uses
gtailq,
mqueue,
time,
signal,
signalvar,

View File

@ -6,7 +6,7 @@ unit kern_thr;
interface
uses
gtailq,
mqueue,
ucontext,
signal,
signalvar;

View File

@ -6,8 +6,8 @@ unit kern_thread;
interface
uses
mqueue,
kern_thr,
gtailq,
ntapi,
windows,
ucontext,

View File

@ -6,7 +6,7 @@ unit kern_umtx;
interface
uses
gtailq,
mqueue,
kern_rwlock,
time,
kern_time,
@ -61,7 +61,6 @@ type
//per thread local
umtx_q=packed record
//pNext,pPrev:p_umtx_q; //uq_link
uq_link:packed record
pNext:p_umtx_q;
pPrev:PPointer;
@ -75,15 +74,12 @@ type
uq_cur_queue :p_umtxq_queue;
end;
//umtxq_head=specialize TAILQ_HEAD<p_umtx_q>;
//per mutex addr
umtxq_queue=packed record
head:packed record
pFirst:p_umtx_q;
pLast :PPointer;
end;
//head :umtxq_head;
length :Integer;
align :Integer;
end;
@ -237,7 +233,6 @@ begin
uh:=umtxq_queue_lookup(key,UMTX_SHARED_QUEUE);
if (uh<>nil) then
begin
//first:=uh^.head.pHead; //TAILQ_FIRST
first :=TAILQ_FIRST(@uh^.head);
Result:=uh^.length;
end;
@ -268,7 +263,6 @@ begin
uh:=umtxq_queue_lookup(uq^.uq_key,q);
//uh^.head.Insert_tail(uq);
TAILQ_INSERT_TAIL(@uh^.head,uq,@uq^.uq_link);
Inc(uh^.length);
@ -284,13 +278,11 @@ begin
begin
uh:=uq^.uq_cur_queue;
//uh^.head.Remove(uq); //uq_link
TAILQ_REMOVE(@uh^.head,uq,@uq^.uq_link);
Dec(uh^.length);
uq^.uq_flags:=uq^.uq_flags and (not UQF_UMTXQ);
//if (uh^.head.pHead=nil) then //TAILQ_EMPTY
if TAILQ_EMPTY(@uh^.head) then
begin
Assert(uh^.length=0,'inconsistent umtxq_queue length');
@ -357,7 +349,6 @@ begin
if (uh<>nil) then
begin
repeat
//uq:=uh^.head.pHead; //TAILQ_FIRST
uq:=TAILQ_FIRST(@uh^.head);
if (uq=nil) then Break;
@ -1072,7 +1063,6 @@ begin
pri:=UPRI(uq_first^.uq_thread);
end;
//uq_first:=uq_first^.pNext;
uq_first:=TAILQ_NEXT(uq_first,@uq_first^.uq_link);
end;
@ -1213,7 +1203,6 @@ begin
pri:=UPRI(uq2^.uq_thread);
end;
uq2:=TAILQ_NEXT(uq2,@uq2^.uq_link);
//uq2:=uq2^.pNext;
end;
if (pri>uq^.uq_inherited_pri) then
@ -1245,7 +1234,6 @@ begin
pri:=UPRI(uq2^.uq_thread);
end;
uq2:=TAILQ_NEXT(uq2,@uq2^.uq_link);
//uq2:=uq2^.pNext;
end;
if (pri>uq^.uq_inherited_pri) then
@ -1326,7 +1314,6 @@ begin
pri:=UPRI(uq2^.uq_thread);
end;
uq2:=TAILQ_NEXT(uq2,@uq2^.uq_link);
//uq2:=uq2^.pNext;
end;
if (pri>uq^.uq_inherited_pri) then

View File

@ -6,7 +6,7 @@ unit subr_sleepqueue;
interface
uses
gtailq,
mqueue,
hamt,
kern_mtx,
kern_thr,

View File

@ -61,10 +61,6 @@
<Filename Value="..\sys_sig.pas"/>
<IsPartOfProject Value="True"/>
</Unit>
<Unit>
<Filename Value="..\..\rtl\gtailq.pas"/>
<IsPartOfProject Value="True"/>
</Unit>
<Unit>
<Filename Value="..\sys_signal.pas"/>
<IsPartOfProject Value="True"/>
@ -177,6 +173,10 @@
<Filename Value="..\kern\rtprio.pas"/>
<IsPartOfProject Value="True"/>
</Unit>
<Unit>
<Filename Value="..\..\rtl\mqueue.pas"/>
<IsPartOfProject Value="True"/>
</Unit>
</Units>
</ProjectOptions>
<CompilerOptions>

View File

@ -2,7 +2,7 @@
uses
windows,
atomic,
ntapi,
ntapi, mqueue,
signal,
ucontext,
_umtx,