Skip to content

Commit 68ccbfe

Browse files
committed
chore: asserts for ExecutorGroup
1 parent 87d0752 commit 68ccbfe

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

include/mrdox/Support/ExecutorGroup.hpp

+6
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ class ExecutorGroup
124124
: group_(group)
125125
, agent_(std::move(agent))
126126
{
127+
MRDOX_ASSERT(agent_.get() != nullptr);
127128
}
128129

129130
~scoped_agent()
@@ -135,21 +136,26 @@ class ExecutorGroup
135136

136137
Agent& operator*() const noexcept
137138
{
139+
MRDOX_ASSERT(agent_.get() != nullptr);
138140
return *agent_;
139141
}
140142
};
141143

142144
void
143145
run(std::unique_lock<std::mutex> lock)
144146
{
147+
MRDOX_ASSERT(lock.owns_lock());
145148
std::unique_ptr<Agent> agent(std::move(agents_.back()));
149+
MRDOX_ASSERT(agent.get() != nullptr);
146150
agents_.pop_back();
147151
++busy_;
148152

149153
threadPool_.async(
150154
[this, agent = std::move(agent)]() mutable
151155
{
156+
MRDOX_ASSERT(agent.get() != nullptr);
152157
scoped_agent scope(*this, std::move(agent));
158+
MRDOX_ASSERT(agent.get() == nullptr);
153159
std::unique_lock<std::mutex> lock(impl_->mutex_);
154160
for(;;)
155161
{

0 commit comments

Comments
 (0)