Fixed current loop not being reset on exceptions.
This commit is contained in:
parent
51092bb4cb
commit
e91184ec82
@ -25,6 +25,7 @@
|
||||
#include "../util/flag.hpp"
|
||||
#include "../util/iterators.hpp"
|
||||
#include "../util/misc.hpp"
|
||||
#include "../util/scope_guard.hpp"
|
||||
#include "../util/traits.hpp"
|
||||
#if MIJIN_COROUTINE_ENABLE_DEBUG_INFO
|
||||
#include "../debug/stacktrace.hpp"
|
||||
@ -997,6 +998,9 @@ inline auto BaseSimpleTaskLoop<TAllocator>::tick() -> CanContinue
|
||||
// set current taskloop
|
||||
MIJIN_ASSERT(TaskLoop<TAllocator>::currentLoopStorage() == nullptr, "Trying to tick a loop from a coroutine, this is not supported.");
|
||||
TaskLoop<TAllocator>::currentLoopStorage() = this;
|
||||
MIJIN_SCOPE_EXIT {
|
||||
TaskLoop<TAllocator>::currentLoopStorage() = nullptr;
|
||||
};
|
||||
threadId_ = std::this_thread::get_id();
|
||||
|
||||
// move over all tasks from newTasks
|
||||
@ -1046,8 +1050,6 @@ inline auto BaseSimpleTaskLoop<TAllocator>::tick() -> CanContinue
|
||||
canContinue = CanContinue::YES;
|
||||
}
|
||||
}
|
||||
// reset current loop
|
||||
TaskLoop<TAllocator>::currentLoopStorage() = nullptr;
|
||||
|
||||
// remove any tasks that have been transferred to another queue
|
||||
it = std::remove_if(tasks_.begin(), tasks_.end(), [](const StoredTask& task) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user