Procházet zdrojové kódy

ft: 确保时间

master
SisMaker před 1 rokem
rodič
revize
d749b95e73
1 změnil soubory, kde provedl 2 přidání a 2 odebrání
  1. +2
    -2
      src/eGLock.erl

+ 2
- 2
src/eGLock.erl Zobrazit soubor

@ -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 ->

Načítá se…
Zrušit
Uložit