aboutsummaryrefslogtreecommitdiffstats
path: root/util/async.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2017-11-21 21:48:43 +0100
committerKim Alvefur <zash@zash.se>2017-11-21 21:48:43 +0100
commitfc8fcb69efd74afc072c04b05ca637616031d9f1 (patch)
treef851a13a16e84e1a5dea940fc76633a54bdc860e /util/async.lua
parentffc6fcf5d32aecc207c9260d86851150a4be48fc (diff)
downloadprosody-fc8fcb69efd74afc072c04b05ca637616031d9f1.tar.gz
prosody-fc8fcb69efd74afc072c04b05ca637616031d9f1.zip
util.async: Fix thread check to work correctly in Lua 5.2
coroutine.running() now returns the main thread and a boolean true if called from the main thread, as opposed to nil in 5.1
Diffstat (limited to 'util/async.lua')
-rw-r--r--util/async.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/util/async.lua b/util/async.lua
index 17a3bae1..992797b8 100644
--- a/util/async.lua
+++ b/util/async.lua
@@ -1,8 +1,8 @@
local log = require "util.logger".init("util.async");
local function checkthread()
- local thread = coroutine.running();
- if not thread then
+ local thread, main = coroutine.running();
+ if not thread or main then
error("Not running in an async context, see https://prosody.im/doc/developers/util/async");
end
return thread;