Browse Source

ft: gen_apu 修改

master otp23
SisMaker 3 years ago
parent
commit
434a259e49
3 changed files with 13 additions and 12 deletions
  1. +8
    -7
      src/gen_apu.erl
  2. +3
    -3
      test/ping3.erl
  3. +2
    -2
      test/pong3.erl

+ 8
- 7
src/gen_apu.erl View File

@ -712,11 +712,11 @@ receiveIng(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurState,
matchCallMsg(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurState, From, Request) ->
NewDebug = ?SYS_DEBUG(Debug, Name, {in, {{call, From}, Request}}),
try
case Request of
{FunName, Args} ->
Module:FunName(Args, CurState, From);
case is_tuple(Request) of
true ->
FunName = element(1, Request),
Module:FunName(Request, CurState, From);
_ ->
Module:Request(CurState, From)
end
@ -733,9 +733,10 @@ matchCallMsg(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurStat
matchCastMsg(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurState, Cast) ->
NewDebug = ?SYS_DEBUG(Debug, Name, {in, {cast, Cast}}),
try
case Cast of
{FunName, Args} ->
Module:FunName(Args, CurState);
case is_tuple(Cast) of
true ->
FunName = element(1, Cast),
Module:FunName(Cast, CurState);
_ ->
Module:Cast(CurState)
end

+ 3
- 3
test/ping3.erl View File

@ -12,7 +12,7 @@ doCall(0, Pid, StartTime) ->
exit(Pid, kill),
io:format("call3 over use time: ~p ns~n", [EndTime - StartTime]);
doCall(N, Pid, StartTime) ->
gen_apu:call(Pid, ping),
gen_apu:call(Pid, mPing),
doCall(N - 1, Pid, StartTime).
send(N) ->
@ -27,7 +27,7 @@ doSend(0, Pid, StartTime) ->
exit(Pid, kill),
io:format("send2 over use time: ~p ~p ns~n", [Ret, EndTime - StartTime]);
doSend(N, Pid, StartTime) ->
gen_apu:send(Pid, ping),
gen_apu:send(Pid, mPing),
doSend(N - 1, Pid, StartTime).
cast(N) ->
@ -42,5 +42,5 @@ doCast(0, Pid, StartTime) ->
exit(Pid, kill),
io:format("cast3 over use time: ~p ~p ns~n", [Ret, EndTime - StartTime]);
doCast(N, Pid, StartTime) ->
gen_apu:cast(Pid, ping2),
gen_apu:cast(Pid, mPing),
doCast(N - 1, Pid, StartTime).

+ 2
- 2
test/pong3.erl View File

@ -10,8 +10,8 @@ start() ->
init(_Args) ->
{ok, 0}.
ping(_State, _From) ->
mPing(_State, _From) ->
{reply, pong}.
ping2(_State) ->
mPing(_State) ->
kpS.

Loading…
Cancel
Save