From 79dcb3ba974b4fb9ca966531da4b5f971a4a89b1 Mon Sep 17 00:00:00 2001 From: SisMaker <156736github> Date: Sun, 10 Apr 2022 09:51:41 +0800 Subject: [PATCH] =?UTF-8?q?ft:=20=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/gen_apu.erl | 31 +++++++++++++++++++++++++++++++ src/gen_mpp.erl | 31 +++++++++++++++++++++++++++++++ src/gen_srv.erl | 31 +++++++++++++++++++++++++++++++ 3 files changed, 93 insertions(+) diff --git a/src/gen_apu.erl b/src/gen_apu.erl index 17bb842..94160ec 100644 --- a/src/gen_apu.erl +++ b/src/gen_apu.erl @@ -117,6 +117,9 @@ {reply, Reply :: term(), NewState :: term(), Actions :: actions()} | {noreply, NewState :: term()} | {noreply, NewState :: term(), Actions :: actions()} | + {mayReply, Reply :: term()} | + {mayReply, Reply :: term(), NewState :: term()} | + {mayReply, Reply :: term(), NewState :: term(), Actions :: actions()} | {stop, Reason :: term(), NewState :: term()} | {stopReply, Reason :: term(), Reply :: term(), NewState :: term()}. @@ -840,12 +843,30 @@ handleCR(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurState, R reply(From, Reply), NewDebug = ?SYS_DEBUG(Debug, Name, {out, Reply, From, CurState}), receiveIng(Parent, Name, Module, HibernateAfterTimeout, NewDebug, Timers, CurState, false); + {mayReply, Reply} -> + case From of + false -> + receiveIng(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurState, false); + _ -> + greply(From, Reply), + NewDebug = ?SYS_DEBUG(Debug, Name, {out, Reply, From, CurState}), + receiveIng(Parent, Name, Module, HibernateAfterTimeout, NewDebug, Timers, CurState, false) + end; {noreply, NewState} -> receiveIng(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, NewState, false); {reply, Reply, NewState} -> reply(From, Reply), NewDebug = ?SYS_DEBUG(Debug, Name, {out, Reply, From, NewState}), receiveIng(Parent, Name, Module, HibernateAfterTimeout, NewDebug, Timers, NewState, false); + {mayReply, Reply, NewState} -> + case From of + false -> + receiveIng(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, NewState, false); + _ -> + greply(From, Reply), + NewDebug = ?SYS_DEBUG(Debug, Name, {out, Reply, From, NewState}), + receiveIng(Parent, Name, Module, HibernateAfterTimeout, NewDebug, Timers, NewState, false) + end; {noreply, NewState, Actions} -> loopEntry(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, NewState, listify(Actions)); {stop, Reason, NewState} -> @@ -854,6 +875,16 @@ handleCR(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurState, R reply(From, Reply), NewDebug = ?SYS_DEBUG(Debug, Name, {out, Reply, From, NewState}), loopEntry(Parent, Name, Module, HibernateAfterTimeout, NewDebug, Timers, NewState, listify(Actions)); + {mayReply, Reply, NewState, Actions} -> + case From of + false -> + loopEntry(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, NewState, listify(Actions)); + _ -> + + greply(From, Reply), + NewDebug = ?SYS_DEBUG(Debug, Name, {out, Reply, From, NewState}), + loopEntry(Parent, Name, Module, HibernateAfterTimeout, NewDebug, Timers, NewState, listify(Actions)) + end; {stopReply, Reason, Reply, NewState} -> NewDebug = ?SYS_DEBUG(Debug, Name, {out, Reply, From, NewState}), try diff --git a/src/gen_mpp.erl b/src/gen_mpp.erl index 773d79b..927fcf6 100644 --- a/src/gen_mpp.erl +++ b/src/gen_mpp.erl @@ -109,6 +109,9 @@ {reply, Reply :: term(), NewState :: term(), Actions :: actions()} | {noreply, NewState :: term()} | {noreply, NewState :: term(), Actions :: actions()} | + {mayReply, Reply :: term()} | + {mayReply, Reply :: term(), NewState :: term()} | + {mayReply, Reply :: term(), NewState :: term(), Actions :: actions()} | {stop, Reason :: term(), NewState :: term()} | {stopReply, Reason :: term(), Reply :: term(), NewState :: term()}. @@ -824,12 +827,30 @@ handleCR(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurState, R reply(From, Reply), NewDebug = ?SYS_DEBUG(Debug, Name, {out, Reply, From, CurState}), receiveIng(Parent, Name, Module, HibernateAfterTimeout, NewDebug, Timers, CurState, false); + {mayReply, Reply} -> + case From of + false -> + receiveIng(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurState, false); + _ -> + greply(From, Reply), + NewDebug = ?SYS_DEBUG(Debug, Name, {out, Reply, From, CurState}), + receiveIng(Parent, Name, Module, HibernateAfterTimeout, NewDebug, Timers, CurState, false) + end; {noreply, NewState} -> receiveIng(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, NewState, false); {reply, Reply, NewState} -> reply(From, Reply), NewDebug = ?SYS_DEBUG(Debug, Name, {out, Reply, From, NewState}), receiveIng(Parent, Name, Module, HibernateAfterTimeout, NewDebug, Timers, NewState, false); + {mayReply, Reply, NewState} -> + case From of + false -> + receiveIng(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, NewState, false); + _ -> + greply(From, Reply), + NewDebug = ?SYS_DEBUG(Debug, Name, {out, Reply, From, NewState}), + receiveIng(Parent, Name, Module, HibernateAfterTimeout, NewDebug, Timers, NewState, false) + end; {noreply, NewState, Actions} -> loopEntry(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, NewState, listify(Actions)); {stop, Reason, NewState} -> @@ -838,6 +859,16 @@ handleCR(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurState, R reply(From, Reply), NewDebug = ?SYS_DEBUG(Debug, Name, {out, Reply, From, NewState}), loopEntry(Parent, Name, Module, HibernateAfterTimeout, NewDebug, Timers, NewState, listify(Actions)); + {mayReply, Reply, NewState, Actions} -> + case From of + false -> + loopEntry(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, NewState, listify(Actions)); + _ -> + + greply(From, Reply), + NewDebug = ?SYS_DEBUG(Debug, Name, {out, Reply, From, NewState}), + loopEntry(Parent, Name, Module, HibernateAfterTimeout, NewDebug, Timers, NewState, listify(Actions)) + end; {stopReply, Reason, Reply, NewState} -> NewDebug = ?SYS_DEBUG(Debug, Name, {out, Reply, From, NewState}), try diff --git a/src/gen_srv.erl b/src/gen_srv.erl index 3588aa1..024b0fc 100644 --- a/src/gen_srv.erl +++ b/src/gen_srv.erl @@ -116,6 +116,9 @@ {reply, Reply :: term(), NewState :: term(), Actions :: actions()} | {noreply, NewState :: term()} | {noreply, NewState :: term(), Actions :: actions()} | + {mayReply, Reply :: term()} | + {mayReply, Reply :: term(), NewState :: term()} | + {mayReply, Reply :: term(), NewState :: term(), Actions :: actions()} | {stop, Reason :: term(), NewState :: term()} | {stopReply, Reason :: term(), Reply :: term(), NewState :: term()}. @@ -814,12 +817,30 @@ handleCR(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurState, R greply(From, Reply), NewDebug = ?SYS_DEBUG(Debug, Name, {out, Reply, From, CurState}), receiveIng(Parent, Name, Module, HibernateAfterTimeout, NewDebug, Timers, CurState, false); + {mayReply, Reply} -> + case From of + false -> + receiveIng(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurState, false); + _ -> + greply(From, Reply), + NewDebug = ?SYS_DEBUG(Debug, Name, {out, Reply, From, CurState}), + receiveIng(Parent, Name, Module, HibernateAfterTimeout, NewDebug, Timers, CurState, false) + end; {noreply, NewState} -> receiveIng(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, NewState, false); {reply, Reply, NewState} -> greply(From, Reply), NewDebug = ?SYS_DEBUG(Debug, Name, {out, Reply, From, NewState}), receiveIng(Parent, Name, Module, HibernateAfterTimeout, NewDebug, Timers, NewState, false); + {mayReply, Reply, NewState} -> + case From of + false -> + receiveIng(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, NewState, false); + _ -> + greply(From, Reply), + NewDebug = ?SYS_DEBUG(Debug, Name, {out, Reply, From, NewState}), + receiveIng(Parent, Name, Module, HibernateAfterTimeout, NewDebug, Timers, NewState, false) + end; {noreply, NewState, Actions} -> loopEntry(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, NewState, listify(Actions)); {stop, Reason, NewState} -> @@ -828,6 +849,16 @@ handleCR(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurState, R greply(From, Reply), NewDebug = ?SYS_DEBUG(Debug, Name, {out, Reply, From, NewState}), loopEntry(Parent, Name, Module, HibernateAfterTimeout, NewDebug, Timers, NewState, listify(Actions)); + {mayReply, Reply, NewState, Actions} -> + case From of + false -> + loopEntry(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, NewState, listify(Actions)); + _ -> + + greply(From, Reply), + NewDebug = ?SYS_DEBUG(Debug, Name, {out, Reply, From, NewState}), + loopEntry(Parent, Name, Module, HibernateAfterTimeout, NewDebug, Timers, NewState, listify(Actions)) + end; {stopReply, Reason, Reply, NewState} -> NewDebug = ?SYS_DEBUG(Debug, Name, {out, Reply, From, NewState}), try