summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Radestock <matthias@rabbitmq.com>2011-10-01 13:30:50 +0100
committerMatthias Radestock <matthias@rabbitmq.com>2011-10-01 13:30:50 +0100
commit189219cb3f51416517fae344eabc692abfae558b (patch)
treeeab705e941ad11b1ad96a830e092065c72830738 /src
parent556e8080c56662ffcc999eea096cef7a33030ad2 (diff)
downloadrabbitmq-server-git-189219cb3f51416517fae344eabc692abfae558b.tar.gz
yes, this really does gain ~1% with MCM with two erlang schedulers
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_channel.erl12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/rabbit_channel.erl b/src/rabbit_channel.erl
index 3d264330d3..3c61447af2 100644
--- a/src/rabbit_channel.erl
+++ b/src/rabbit_channel.erl
@@ -374,10 +374,16 @@ noreply(Mask, NewState) -> noreply(Mask, NewState, hibernate).
noreply(Mask, NewState, Timeout) ->
{noreply, next_state(Mask, NewState), Timeout}.
+-define(MASKED_CALL(Fun, Mask, State),
+ case lists:member(Fun, Mask) of
+ true -> State;
+ false -> Fun(State)
+ end).
+
next_state(Mask, State) ->
- lists:foldl(fun (ensure_stats_timer, State1) -> ensure_stats_timer(State1);
- (send_confirms, State1) -> send_confirms(State1)
- end, State, [ensure_stats_timer, send_confirms] -- Mask).
+ State1 = ?MASKED_CALL(ensure_stats_timer, Mask, State),
+ State2 = ?MASKED_CALL(send_confirms, Mask, State1),
+ State2.
ensure_stats_timer(State = #ch{stats_timer = StatsTimer}) ->
State#ch{stats_timer = rabbit_event:ensure_stats_timer(