Commit 61b7959b authored by eric's avatar eric

bugfix to prevent accessing the reclaimed task

parent 476818df
......@@ -348,11 +348,10 @@ void TimerThread::run() {
// Pull tasks from buckets.
for (size_t i = 0; i < _options.num_buckets; ++i) {
Bucket& bucket = _buckets[i];
Task* next_task = nullptr;
for (Task* p = bucket.consume_tasks(); p != nullptr; ++nscheduled) {
// p->next should be kept first
// in case of the deletion of Task p which is unscheduled
next_task = p->next;
Task* next_task = p->next;
if (!p->try_delete()) { // remove the task if it's unscheduled
tasks.push_back(p);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment