Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
Please login to access the resource
home:Ledest:erlang:23
erlang
1021-gen_event-eliminate-selective-receive-in-f...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 1021-gen_event-eliminate-selective-receive-in-fetch_msg-6.patch of Package erlang
From 9074e5f58bd3e636d1719c128e0c477b60dcf9b5 Mon Sep 17 00:00:00 2001 From: Mikael Pettersson <mikael.pettersson@klarna.com> Date: Thu, 4 Aug 2022 18:50:26 +0200 Subject: [PATCH] gen_event: eliminate selective-receive in fetch_msg/6 Perform a non-selective receive with timeout, and pass the message to factored-out decode_msg/7, similar to gen_server. --- lib/stdlib/src/gen_event.erl | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/stdlib/src/gen_event.erl b/lib/stdlib/src/gen_event.erl index 20d9910374..fd4b5d9add 100644 --- a/lib/stdlib/src/gen_event.erl +++ b/lib/stdlib/src/gen_event.erl @@ -499,19 +499,25 @@ wake_hib(Parent, ServerName, MSL, HibernateAfterTimeout, Debug) -> fetch_msg(Parent, ServerName, MSL, HibernateAfterTimeout, Debug, Hib) -> receive + Msg -> + decode_msg(Msg, Parent, ServerName, MSL, HibernateAfterTimeout, Debug, Hib) + after HibernateAfterTimeout -> + loop(Parent, ServerName, MSL, HibernateAfterTimeout, Debug, true) + end. + +decode_msg(Msg, Parent, ServerName, MSL, HibernateAfterTimeout, Debug, Hib) -> + case Msg of {system, From, Req} -> sys:handle_system_msg(Req, From, Parent, ?MODULE, Debug, [ServerName, MSL, HibernateAfterTimeout, Hib],Hib); {'EXIT', Parent, Reason} -> terminate_server(Reason, Parent, MSL, ServerName); - Msg when Debug =:= [] -> + _Msg when Debug =:= [] -> handle_msg(Msg, Parent, ServerName, MSL, HibernateAfterTimeout, []); - Msg -> + _Msg -> Debug1 = sys:handle_debug(Debug, fun print_event/3, ServerName, {in, Msg}), handle_msg(Msg, Parent, ServerName, MSL, HibernateAfterTimeout, Debug1) - after HibernateAfterTimeout -> - loop(Parent, ServerName, MSL, HibernateAfterTimeout, Debug, true) end. handle_msg(Msg, Parent, ServerName, MSL, HibernateAfterTimeout, Debug) -> -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor