2
0
mirror of https://github.com/boostorg/fiber.git synced 2026-02-18 01:52:24 +00:00

add support for signaling a context as ready

This commit is contained in:
Oliver Kowalke
2015-09-19 16:19:02 +02:00
parent 59946d4426
commit 943e21e69b
4 changed files with 52 additions and 3 deletions

View File

@@ -171,6 +171,22 @@ context::wait_until( std::chrono::steady_clock::time_point const& tp) noexcept {
return scheduler_->wait_until( this, tp);
}
void
context::set_ready( context * ctx) noexcept {
BOOST_ASSERT( nullptr != ctx);
BOOST_ASSERT( this != ctx);
// FIXME: comparing scheduler address' must be synchronized?
// what if ctx is migrated between threads
// (other scheduler assigned)
if ( scheduler_ == ctx->scheduler_) {
// local
scheduler_->set_ready( ctx);
} else {
// remote
scheduler_->set_remote_ready( ctx);
}
}
bool
context::wait_is_linked() {
return wait_hook_.is_linked();