* [PATCH 3/4] daemon: avoid cyclic references for once-used callbacks
2016-03-05 6:07 5% [PATCH 0/4] daemon-related cleanups Eric Wong
@ 2016-03-05 6:07 7% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2016-03-05 6:07 UTC (permalink / raw)
To: meta
Not that these subs are repeatedly created, but this makes
the code easier-to-review and these callbacks are idempotent
anyways.
---
lib/PublicInbox/Daemon.pm | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lib/PublicInbox/Daemon.pm b/lib/PublicInbox/Daemon.pm
index c3199cd..30411e1 100644
--- a/lib/PublicInbox/Daemon.pm
+++ b/lib/PublicInbox/Daemon.pm
@@ -109,6 +109,7 @@ sub daemonize () {
# The upgrade will create the ".oldbin" pid file in the
# same directory as the given pid file.
$uid and $set_user = sub {
+ $set_user = undef;
Net::Server::Daemonize::set_user($uid, $gid);
};
@@ -128,6 +129,7 @@ sub daemonize () {
write_pid($pid_file);
my $unlink_pid = $$;
$cleanup = sub {
+ $cleanup = undef; # avoid cyclic reference
unlink_pid_file_safe_ish($unlink_pid, $pid_file);
};
}
--
EW
^ permalink raw reply related [relevance 7%]
* [PATCH 0/4] daemon-related cleanups
@ 2016-03-05 6:07 5% Eric Wong
2016-03-05 6:07 7% ` [PATCH 3/4] daemon: avoid cyclic references for once-used callbacks Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2016-03-05 6:07 UTC (permalink / raw)
To: meta
Nothing earth-shattering, but we need to start documenting
this for users if we expect people to start using it :p.
Eric Wong (4):
t/httpd-corner: additional callback test
daemon: drop listener sockets ASAP on termination
daemon: avoid cyclic references for once-used callbacks
daemon: simplify parent death handling
lib/PublicInbox/Daemon.pm | 9 +++++++--
t/httpd-corner.psgi | 9 +++++++++
t/httpd-corner.t | 9 +++++++++
3 files changed, 25 insertions(+), 2 deletions(-)
^ permalink raw reply [relevance 5%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2016-03-05 6:07 5% [PATCH 0/4] daemon-related cleanups Eric Wong
2016-03-05 6:07 7% ` [PATCH 3/4] daemon: avoid cyclic references for once-used callbacks Eric Wong
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).