Comparison

util/async.lua @ 10931:558f0555ba02

util.async: Don't attempt to close thread if not created yet
author Matthew Wild <mwild1@gmail.com>
date Sun, 14 Jun 2020 09:40:08 +0100
parent 10930:69a4b0e3565f
child 11961:542a9a503073
comparison
equal deleted inserted replaced
10930:69a4b0e3565f 10931:558f0555ba02
158 end 158 end
159 159
160 local q, thread = self.queue, self.thread; 160 local q, thread = self.queue, self.thread;
161 if not thread or coroutine.status(thread) == "dead" then 161 if not thread or coroutine.status(thread) == "dead" then
162 --luacheck: ignore 143/coroutine 162 --luacheck: ignore 143/coroutine
163 if coroutine.close then 163 if thread and coroutine.close then
164 coroutine.close(thread); 164 coroutine.close(thread);
165 end 165 end
166 self:log("debug", "creating new coroutine"); 166 self:log("debug", "creating new coroutine");
167 -- Create a new coroutine for this runner 167 -- Create a new coroutine for this runner
168 thread = runner_create_thread(self.func, self); 168 thread = runner_create_thread(self.func, self);