Dont try to resume dead threads in the scheduler

This commit is contained in:
Filip Tibell 2023-08-19 18:44:43 -05:00
parent f8e32219fa
commit 2bde5e8ae8
No known key found for this signature in database

View file

@ -34,6 +34,12 @@ where
let thread_id = thread.id(); let thread_id = thread.id();
let (thread, args) = thread.into_inner(self.lua); let (thread, args) = thread.into_inner(self.lua);
// Make sure this thread is still resumable, it might have
// been resumed somewhere else or even have been cancelled
if thread.status() != LuaThreadStatus::Resumable {
continue;
}
// Resume the thread, ensuring that the schedulers // Resume the thread, ensuring that the schedulers
// current thread id is set correctly for error catching // current thread id is set correctly for error catching
self.state.set_current_thread_id(Some(thread_id)); self.state.set_current_thread_id(Some(thread_id));