|
@@ -70,7 +70,6 @@ Function LockMutexTimeoutNoWait(var m : TWasmMutex; aTimeOutNS : Int64) : TLockM
|
|
|
|
|
|
Var
|
|
Var
|
|
Res : TLockMutexResult;
|
|
Res : TLockMutexResult;
|
|
- MyThread : TThreadID;
|
|
|
|
EndTime: TOSTime;
|
|
EndTime: TOSTime;
|
|
|
|
|
|
begin
|
|
begin
|
|
@@ -80,13 +79,10 @@ begin
|
|
EndTime:=GetClockTime+aTimeOutNS
|
|
EndTime:=GetClockTime+aTimeOutNS
|
|
else
|
|
else
|
|
EndTime:=0;
|
|
EndTime:=0;
|
|
- MyThread:=GetSelfThread;
|
|
|
|
{$IFDEF DEBUGWASMTHREADS}DebugWriteln('LockMutexTimeoutNoWait: entering loop');{$ENDIF}
|
|
{$IFDEF DEBUGWASMTHREADS}DebugWriteln('LockMutexTimeoutNoWait: entering loop');{$ENDIF}
|
|
Repeat
|
|
Repeat
|
|
if TryLockMutex(M) then
|
|
if TryLockMutex(M) then
|
|
Res:=lmrOK
|
|
Res:=lmrOK
|
|
- else if (GetThreadState(MyThread)<>tsRunning) then
|
|
|
|
- Res:=lmrError
|
|
|
|
else if (aTimeOutNS>=0) and (GetClockTime>EndTime) then
|
|
else if (aTimeOutNS>=0) and (GetClockTime>EndTime) then
|
|
Res:=lmrTimeOut;
|
|
Res:=lmrTimeOut;
|
|
Until (res<>lmrNone);
|
|
Until (res<>lmrNone);
|
|
@@ -98,14 +94,12 @@ Function LockMutexTimeoutWait(var m : TWasmMutex; aTimeOutNS : Int64) : TLockMut
|
|
|
|
|
|
Var
|
|
Var
|
|
Res : TLockMutexResult;
|
|
Res : TLockMutexResult;
|
|
- MyThread : TThreadID;
|
|
|
|
EndTime: TOSTime;
|
|
EndTime: TOSTime;
|
|
RemainingTime: Int64;
|
|
RemainingTime: Int64;
|
|
|
|
|
|
begin
|
|
begin
|
|
{$IFDEF DEBUGWASMTHREADS}DebugWriteln('LockMutexTimeoutWait('+IntToStr(m.locked)+','+intToStr(aTimeOutNS)+')');{$ENDIF}
|
|
{$IFDEF DEBUGWASMTHREADS}DebugWriteln('LockMutexTimeoutWait('+IntToStr(m.locked)+','+intToStr(aTimeOutNS)+')');{$ENDIF}
|
|
Res:=lmrNone;
|
|
Res:=lmrNone;
|
|
- MyThread:=GetSelfThread;
|
|
|
|
if aTimeOutNS>=0 then
|
|
if aTimeOutNS>=0 then
|
|
EndTime:=GetClockTime+aTimeOutNS
|
|
EndTime:=GetClockTime+aTimeOutNS
|
|
else
|
|
else
|
|
@@ -134,8 +128,6 @@ begin
|
|
2:
|
|
2:
|
|
if M.Destroying then
|
|
if M.Destroying then
|
|
Res:=lmrError
|
|
Res:=lmrError
|
|
- else if (GetThreadState(MyThread)<>tsRunning) then
|
|
|
|
- Res:=lmrError
|
|
|
|
else
|
|
else
|
|
Res:=lmrTimeOut;
|
|
Res:=lmrTimeOut;
|
|
end;
|
|
end;
|