Changeset

8655:ba6a6a04b46c

util.async: Allow nil as a guard key
author Matthew Wild <mwild1@gmail.com>
date Thu, 22 Mar 2018 16:26:09 +0000
parents 8654:425de10efde4
children 8656:0e84814a7ece
files util/async.lua
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/util/async.lua	Thu Mar 22 16:25:20 2018 +0000
+++ b/util/async.lua	Thu Mar 22 16:26:09 2018 +0000
@@ -84,7 +84,9 @@
 
 local function guarder()
 	local guards = {};
+	local default_id = {};
 	return function (id, func)
+		id = id or default_id;
 		local thread = checkthread();
 		local guard = guards[id];
 		if not guard then