Skip to content

Commit

Permalink
scheduling_group_demo: add explicit yields since future::get() no lon…
Browse files Browse the repository at this point in the history
…ger does

With 7e2483a, future::get() is no longer an implicit yield. This causes
the threads spawned in scheduling_group_demo to never yield and the demo
no longer works.

Adding explicit yields makes it work again.
Message-Id: <[email protected]>
  • Loading branch information
avikivity authored and tgrabiec committed Sep 4, 2019
1 parent cc302c5 commit fcf0aa7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions demos/scheduling_group_demo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ run_compute_intensive_tasks(seastar::scheduling_group sg, done_func done, unsign
return task(counter);
});
}).get();
thread::maybe_yield();
}
});
}
Expand All @@ -92,6 +93,7 @@ run_compute_intensive_tasks_in_threads(seastar::scheduling_group sg, done_func d
return seastar::async(attr, [done, &counter, task] {
while (!done()) {
task(counter).get();
thread::maybe_yield();
}
});
});
Expand All @@ -113,6 +115,7 @@ run_with_duty_cycle(float utilization, std::chrono::steady_clock::duration perio
while (!done()) {
while (!combined_done()) {
task(std::cref(combined_done)).get();
thread::maybe_yield();
}
cv.wait([&] {
return done() || duty_toggle;
Expand Down

0 comments on commit fcf0aa7

Please sign in to comment.