Skip to content

Commit

Permalink
[FIX] Fix exception safety.
Browse files Browse the repository at this point in the history
  • Loading branch information
paintdream authored May 29, 2024
1 parent f8402d6 commit 025f3cc
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/iris_dispatcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -546,8 +546,7 @@ namespace iris {

// execute all tasks scheduled at once.
template <bool s, bool force>
typename std::enable_if<s>::type execute_internal() noexcept(
noexcept(std::declval<iris_warp_t>().flush()) && noexcept(std::declval<function_t>()())) {
typename std::enable_if<s>::type execute_internal() {
IRIS_PROFILE_SCOPE(__FUNCTION__);

// mark for queueing, avoiding flush me more than once.
Expand All @@ -571,30 +570,25 @@ namespace iris {
}

p = q;
} else {
storage.executing_head = nullptr;
}

while (p != nullptr) {
task_t* q = p->next;
storage.executing_head = p->next;
p->next = nullptr;
async_worker.execute_task(p);
execute_counter++;

if ((!force && suspend_count.load(std::memory_order_relaxed) != 0) || *warp_ptr != this) {
IRIS_ASSERT(storage.executing_head == nullptr);
storage.executing_head = q;
return;
}

p = q;
p = storage.executing_head;
}
} while (execute_counter != 0);
}

template <bool s, bool force>
typename std::enable_if<!s>::type execute_internal() noexcept(
noexcept(std::declval<iris_warp_t>().flush()) && noexcept(std::declval<function_t>()())) {
typename std::enable_if<!s>::type execute_internal() noexcept(noexcept(std::declval<function_t>()())) {
IRIS_PROFILE_SCOPE(__FUNCTION__);

// mark for queueing, avoiding flush me more than once.
Expand Down

0 comments on commit 025f3cc

Please sign in to comment.