ソースを参照

ft: 代码修过

master
SisMaker 1年前
コミット
733d865105
1個のファイルの変更4行の追加4行の削除
  1. +4
    -4
      src/eGLock.erl

+ 4
- 4
src/eGLock.erl ファイルの表示

@ -15,9 +15,9 @@ lockApply(KeyOrKeys, MFAOrFun) ->
lockApply(KeyOrKeys, MFAOrFun, TimeOut) -> lockApply(KeyOrKeys, MFAOrFun, TimeOut) ->
case KeyOrKeys of case KeyOrKeys of
{_, _} -> {_, _} ->
lockApply(KeyOrKeys, MFAOrFun, TimeOut, erlang:system_time(microsecond));
lockApply(KeyOrKeys, MFAOrFun, TimeOut, erlang:system_time(millisecond));
_ -> _ ->
lockApplys(KeyOrKeys, MFAOrFun, TimeOut, erlang:system_time(microsecond))
lockApplys(KeyOrKeys, MFAOrFun, TimeOut, erlang:system_time(millisecond))
end. end.
-define(CASE(Cond, Then, That), case Cond of true -> Then; _ -> That end). -define(CASE(Cond, Then, That), case Cond of true -> Then; _ -> That end).
@ -38,7 +38,7 @@ lockApply(Key, MFAOrFun, TimeOut, FirstTime) ->
ok ok
end; end;
_ -> _ ->
LTimeOut = ?CASE(TimeOut == infinity, TimeOut, max(0, TimeOut - max(erlang:system_time(microsecond) - FirstTime, 0))),
LTimeOut = ?CASE(TimeOut == infinity, TimeOut, max(0, TimeOut - max(erlang:system_time(millisecond) - FirstTime, 0))),
receive receive
?ReTryLockApply -> ?ReTryLockApply ->
lockApply(Key, MFAOrFun, TimeOut, FirstTime) lockApply(Key, MFAOrFun, TimeOut, FirstTime)
@ -64,7 +64,7 @@ lockApplys(Keys, MFAOrFun, TimeOut, FirstTime) ->
ok ok
end; end;
_ -> _ ->
LTimeOut = ?CASE(TimeOut == infinity, TimeOut, max(0, TimeOut - max(erlang:system_time(microsecond) - FirstTime, 0))),
LTimeOut = ?CASE(TimeOut == infinity, TimeOut, max(0, TimeOut - max(erlang:system_time(millisecond) - FirstTime, 0))),
receive receive
?ReTryLockApply -> ?ReTryLockApply ->
lockApplys(Keys, MFAOrFun, TimeOut, FirstTime) lockApplys(Keys, MFAOrFun, TimeOut, FirstTime)

読み込み中…
キャンセル
保存