aboutsummaryrefslogtreecommitdiffstats
path: root/prosody
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2018-03-23 14:18:27 +0000
committerMatthew Wild <mwild1@gmail.com>2018-03-23 14:18:27 +0000
commit6105bc5d3481d55e5d7d08655270b22b154b5089 (patch)
tree5710c3eba810dec6c6ba98f0bb9d9388fb7993e2 /prosody
parenta8f9a2757f09c1b9c83081034e5ef1106ff47d8d (diff)
downloadprosody-6105bc5d3481d55e5d7d08655270b22b154b5089.tar.gz
prosody-6105bc5d3481d55e5d7d08655270b22b154b5089.zip
prosody, util.startup: Switch from async.once() to long-lived thread, to avoid GC
Diffstat (limited to 'prosody')
-rwxr-xr-xprosody9
1 files changed, 7 insertions, 2 deletions
diff --git a/prosody b/prosody
index b2e74af7..87207f4b 100755
--- a/prosody
+++ b/prosody
@@ -50,8 +50,13 @@ if #arg > 0 and arg[1] ~= "--config" then
end
local startup = require "util.startup";
+local async = require "util.async";
-startup.prosody();
+-- Note: it's important that this thread is not GC'd, as some C libraries
+-- that are initialized here store a pointer to it ( :/ ).
+local thread = async.runner();
+
+thread:run(startup.prosody);
local function loop()
-- Error handler for errors that make it this far
@@ -88,4 +93,4 @@ cleanup();
prosody.events.fire_event("server-stopped");
log("info", "Shutdown complete");
-os.exit(prosody.shutdown_code)
+os.exit(prosody.shutdown_code);