Ver a proveniência

ft: 确保时间

master
SisMaker há 1 ano
ascendente
cometimento
d749b95e73
1 ficheiros alterados com 2 adições e 2 eliminações
  1. +2
    -2
      src/eGLock.erl

+ 2
- 2
src/eGLock.erl Ver ficheiro

@ -44,7 +44,7 @@ lockApply(Key, MFAOrFun, TimeOut, LastTime) ->
lockApply(Key, MFAOrFun, TimeOut, LastTime);
_ ->
CurTime = erlang:system_time(microsecond),
NewTimeOut = TimeOut - max(CurTime - LastTime, 0),
NewTimeOut = max(0, TimeOut - max(CurTime - LastTime, 0)),
lockApply(Key, MFAOrFun, NewTimeOut, CurTime)
end
after TimeOut ->
@ -76,7 +76,7 @@ lockApplys(Keys, MFAOrFun, TimeOut, LastTime) ->
lockApplys(Keys, MFAOrFun, TimeOut, LastTime);
_ ->
CurTime = erlang:system_time(microsecond),
NewTimeOut = TimeOut - max(CurTime - LastTime, 0),
NewTimeOut = max(0, TimeOut - max(CurTime - LastTime, 0)),
lockApplys(Keys, MFAOrFun, NewTimeOut, CurTime)
end
after TimeOut ->

Carregando…
Cancelar
Guardar