Skip to content

Commit

Permalink
chore: asserts for ExecutorGroup
Browse files Browse the repository at this point in the history
  • Loading branch information
vinniefalco committed Jun 15, 2023
1 parent 87d0752 commit 68ccbfe
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions include/mrdox/Support/ExecutorGroup.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ class ExecutorGroup
: group_(group)
, agent_(std::move(agent))
{
MRDOX_ASSERT(agent_.get() != nullptr);
}

~scoped_agent()
Expand All @@ -135,21 +136,26 @@ class ExecutorGroup

Agent& operator*() const noexcept
{
MRDOX_ASSERT(agent_.get() != nullptr);
return *agent_;
}
};

void
run(std::unique_lock<std::mutex> lock)
{
MRDOX_ASSERT(lock.owns_lock());
std::unique_ptr<Agent> agent(std::move(agents_.back()));
MRDOX_ASSERT(agent.get() != nullptr);
agents_.pop_back();
++busy_;

threadPool_.async(
[this, agent = std::move(agent)]() mutable
{
MRDOX_ASSERT(agent.get() != nullptr);
scoped_agent scope(*this, std::move(agent));
MRDOX_ASSERT(agent.get() == nullptr);
std::unique_lock<std::mutex> lock(impl_->mutex_);
for(;;)
{
Expand Down

0 comments on commit 68ccbfe

Please sign in to comment.