This commit is contained in:
Pavel 2022-11-10 15:31:42 +03:00
parent 6226cceb19
commit 99393e0e19
2 changed files with 28 additions and 24 deletions

View File

@ -333,6 +333,7 @@ begin
Result:=0; Result:=0;
repeat repeat
spin_lock(ef^.lock_list);
if (node.ret<>1) then //is signaled if (node.ret<>1) then //is signaled
begin begin
if (pResultPat<>nil) then if (pResultPat<>nil) then
@ -340,14 +341,15 @@ begin
pResultPat^:=node.ResultPat; pResultPat^:=node.ResultPat;
end; end;
Result:=node.ret; Result:=node.ret;
spin_unlock(ef^.lock_list);
Break; Break;
end else end else
if (Result=EINTR) then if (Result=EINTR) then
begin begin
spin_unlock(ef^.lock_list);
Break; Break;
end; end;
spin_lock(ef^.lock_list);
if _test_and_set(ef,bitPattern,waitMode,pResultPat) then if _test_and_set(ef,bitPattern,waitMode,pResultPat) then
begin begin
store_seq_cst(node.ret,0); store_seq_cst(node.ret,0);

View File

@ -418,17 +418,19 @@ begin
repeat repeat
spin_lock(sv^.vlock);
if (node.ret<>1) then //is signaled if (node.ret<>1) then //is signaled
begin begin
Result:=node.ret; Result:=node.ret;
spin_unlock(sv^.vlock);
Break; Break;
end else end else
if (Result=EINTR) then if (Result=EINTR) then
begin begin
spin_unlock(sv^.vlock);
Break; Break;
end; end;
spin_lock(sv^.vlock);
if (sv^.value>=count) then if (sv^.value>=count) then
begin begin
Dec(sv^.value,count); Dec(sv^.value,count);