Skip to content

Commit f06b72a

Browse files
committed
addressed the suggestions
Signed-off-by: Denis Mindolin <[email protected]>
1 parent 7baf7f9 commit f06b72a

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

quantum/util/impl/quantum_sequencer_experimental_impl.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,14 @@ Sequencer<SequenceKey, Hash, KeyEqual, Allocator>::addPendingTask(
101101

102102
template <class SequenceKey, class Hash, class KeyEqual, class Allocator>
103103
std::shared_ptr<SequencerTask<SequenceKey>>
104-
Sequencer<SequenceKey, Hash, KeyEqual, Allocator>::removePending(
104+
Sequencer<SequenceKey, Hash, KeyEqual, Allocator>::removeCompleted(
105105
SequencerKeyData<SequenceKey>& entry,
106106
const std::shared_ptr<SequencerTask<SequenceKey>>& task)
107107
{
108108
// Regular tasks tasks:
109109
// * entry._tasks.empty() means that there's a bug somewhere: when we intend to delete a pending task,
110110
// the task queue must not be empty
111-
// * entry._tasks.front() == task means that there's a bug somewhere:
111+
// * entry._tasks.front() != task means that there's a bug somewhere:
112112
// only completed tasks are removed from the queue, and such tasks must sit at the head of the queue
113113
// Universal tasks: because we do not track the queues where universal tasks are enqueued,
114114
// entry._tasks.empty() or entry._tasks.front() != task just means that the task was never enqueued
@@ -135,7 +135,7 @@ Sequencer<SequenceKey, Hash, KeyEqual, Allocator>::removePending(
135135

136136
template <class SequenceKey, class Hash, class KeyEqual, class Allocator>
137137
void
138-
Sequencer<SequenceKey, Hash, KeyEqual, Allocator>::removePending(
138+
Sequencer<SequenceKey, Hash, KeyEqual, Allocator>::removeCompletedAndScheduleNext(
139139
VoidContextPtr ctx,
140140
const std::shared_ptr<SequencerTask<SequenceKey>>& task)
141141
{
@@ -145,14 +145,14 @@ Sequencer<SequenceKey, Hash, KeyEqual, Allocator>::removePending(
145145
// remove the task from all key queues
146146
for(auto& item : _pendingTaskQueueMap)
147147
{
148-
if (std::shared_ptr<SequencerTask<SequenceKey>> nextTask = removePending(item.second, task))
148+
if (auto nextTask = removeCompleted(item.second, task))
149149
{
150150
scheduleTask(nextTask);
151151
}
152152
}
153153

154154
// remove the task from the universal queue
155-
if (std::shared_ptr<SequencerTask<SequenceKey>> nextTask = removePending(_universalTaskQueue, task))
155+
if (auto nextTask = removeCompleted(_universalTaskQueue, task))
156156
{
157157
scheduleTask(nextTask);
158158
}
@@ -162,7 +162,7 @@ Sequencer<SequenceKey, Hash, KeyEqual, Allocator>::removePending(
162162
// remove the task from its key queues only
163163
for(SequencerKeyData<SequenceKey>* data : task->_keyData)
164164
{
165-
if (std::shared_ptr<SequencerTask<SequenceKey>> nextTask = removePending(*data, task))
165+
if (auto nextTask = removeCompleted(*data, task))
166166
{
167167
scheduleTask(nextTask);
168168
}
@@ -200,7 +200,7 @@ Sequencer<SequenceKey, Hash, KeyEqual, Allocator>::executePending(
200200
}
201201

202202
// remove the task from the pending queues + schedule next tasks
203-
sequencer->removePending(ctx, task);
203+
sequencer->removeCompletedAndScheduleNext(ctx, task);
204204
return rc;
205205
}
206206

quantum/util/quantum_sequencer_experimental.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -258,18 +258,18 @@ class Sequencer
258258
void scheduleTask(
259259
const std::shared_ptr<SequencerTask<SequenceKey>>& task);
260260

261-
/// @brief Removes the task from the pending queues and schedule next tasks
261+
/// @brief Removes a completed task from the pending queues and schedule next tasks
262262
/// @param ctx context
263263
/// @param task the task to remove
264-
void removePending(
264+
void removeCompletedAndScheduleNext(
265265
VoidContextPtr ctx,
266266
const std::shared_ptr<SequencerTask<SequenceKey>>& task);
267267

268-
/// @brief Removes the task from the pending queue
268+
/// @brief Removes a completed task from the pending queue
269269
/// @param entry the queue container
270270
/// @param task the task to remove
271271
/// @return next task to be scheduled
272-
std::shared_ptr<SequencerTask<SequenceKey>> removePending(
272+
std::shared_ptr<SequencerTask<SequenceKey>> removeCompleted(
273273
SequencerKeyData<SequenceKey>& entry,
274274
const std::shared_ptr<SequencerTask<SequenceKey>>& task);
275275

0 commit comments

Comments
 (0)