mirror of
https://github.com/red-prig/fpPS4.git
synced 2024-11-23 14:29:53 +00:00
fix
This commit is contained in:
parent
c1e230cc5a
commit
23293839ea
@ -71,7 +71,8 @@ implementation
|
|||||||
|
|
||||||
Uses
|
Uses
|
||||||
atomic,
|
atomic,
|
||||||
sys_kernel;
|
sys_kernel,
|
||||||
|
sys_signal;
|
||||||
|
|
||||||
Procedure backoff_exp.Wait;
|
Procedure backoff_exp.Wait;
|
||||||
Var
|
Var
|
||||||
@ -177,18 +178,20 @@ end;
|
|||||||
function spin_trylock(var t:r_spin_lock):Boolean;
|
function spin_trylock(var t:r_spin_lock):Boolean;
|
||||||
begin
|
begin
|
||||||
Result:=True;
|
Result:=True;
|
||||||
if spin_trylock(t._lock) then
|
_sig_lock;
|
||||||
begin
|
if spin_trylock(t._lock) then
|
||||||
t.count:=0;
|
begin
|
||||||
t.owner:=GetCurrentThreadId;
|
t.count:=0;
|
||||||
end else
|
t.owner:=GetCurrentThreadId;
|
||||||
if (t.owner=GetCurrentThreadId) then
|
end else
|
||||||
begin
|
if (t.owner=GetCurrentThreadId) then
|
||||||
Inc(t.count);
|
begin
|
||||||
end else
|
Inc(t.count);
|
||||||
begin
|
end else
|
||||||
Result:=False;
|
begin
|
||||||
end;
|
Result:=False;
|
||||||
|
end;
|
||||||
|
_sig_unlock;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure spin_lock(var t:r_spin_lock);
|
procedure spin_lock(var t:r_spin_lock);
|
||||||
@ -201,15 +204,16 @@ end;
|
|||||||
|
|
||||||
procedure spin_unlock(var t:r_spin_lock);
|
procedure spin_unlock(var t:r_spin_lock);
|
||||||
begin
|
begin
|
||||||
if (t.count<=1) then
|
_sig_lock;
|
||||||
begin
|
if (t.count=0) then
|
||||||
t.count:=0;
|
begin
|
||||||
t.owner:=DWORD(-1);
|
t.owner:=DWORD(-1);
|
||||||
spin_unlock(t._lock);
|
spin_unlock(t._lock);
|
||||||
end else
|
end else
|
||||||
begin
|
begin
|
||||||
Dec(t.count);
|
Dec(t.count);
|
||||||
end;
|
end;
|
||||||
|
_sig_unlock;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
Loading…
Reference in New Issue
Block a user