aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_posix.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-10-06 14:50:47 +0200
committerKim Alvefur <zash@zash.se>2021-10-06 14:50:47 +0200
commit89f110bbf20dd54c438ea0bce274860cee75606c (patch)
tree676febd357492e8e3c2872a2a2afa7248ee3794f /plugins/mod_posix.lua
parentaa20355fa2c1a65dce264c4a5e95fca8d789ecf2 (diff)
downloadprosody-89f110bbf20dd54c438ea0bce274860cee75606c.tar.gz
prosody-89f110bbf20dd54c438ea0bce274860cee75606c.zip
mod_posix: Run signal handlers in the startup thread
Diffstat (limited to 'plugins/mod_posix.lua')
-rw-r--r--plugins/mod_posix.lua20
1 files changed, 13 insertions, 7 deletions
diff --git a/plugins/mod_posix.lua b/plugins/mod_posix.lua
index 3ef8a632..7f048be3 100644
--- a/plugins/mod_posix.lua
+++ b/plugins/mod_posix.lua
@@ -130,22 +130,28 @@ if have_signal then
module:add_timer(0, function ()
signal.signal("SIGTERM", function ()
module:log("warn", "Received SIGTERM");
- prosody.unlock_globals();
- prosody.shutdown("Received SIGTERM");
- prosody.lock_globals();
+ prosody.main_thread:run(function ()
+ prosody.unlock_globals();
+ prosody.shutdown("Received SIGTERM");
+ prosody.lock_globals();
+ end);
end);
signal.signal("SIGHUP", function ()
module:log("info", "Received SIGHUP");
- prosody.reload_config();
+ prosody.main_thread:run(function ()
+ prosody.reload_config();
+ end);
-- this also reloads logging
end);
signal.signal("SIGINT", function ()
module:log("info", "Received SIGINT");
- prosody.unlock_globals();
- prosody.shutdown("Received SIGINT");
- prosody.lock_globals();
+ prosody.main_thread:run(function ()
+ prosody.unlock_globals();
+ prosody.shutdown("Received SIGINT");
+ prosody.lock_globals();
+ end);
end);
signal.signal("SIGUSR1", function ()