Diff

util/async.lua @ 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
parent 8651:1b7c5933b215
child 8669:2aa85b0cd2b8
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