Software /
code /
prosody
Diff
prosody @ 8682:151ecd18d624
prosody, util.startup: Switch from async.once() to long-lived thread, to avoid GC
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 23 Mar 2018 14:18:27 +0000 |
parent | 8635:47e3b8b6f17a |
child | 8714:e1c4bdb2cd25 |
line wrap: on
line diff
--- a/prosody Fri Mar 23 14:02:33 2018 +0000 +++ b/prosody Fri Mar 23 14:18:27 2018 +0000 @@ -50,8 +50,13 @@ 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 @@ prosody.events.fire_event("server-stopped"); log("info", "Shutdown complete"); -os.exit(prosody.shutdown_code) +os.exit(prosody.shutdown_code);