2
0
mirror of https://github.com/boostorg/fiber.git synced 2026-02-20 02:32:19 +00:00

use yield-queue because work-sharing

- yield-queue prevents resumtion of a fiber which is passed to
  awakened() but has not yet suspended
This commit is contained in:
Oliver Kowalke
2015-10-10 21:52:03 +02:00
parent ecab1c5ee6
commit dbfd80fb2d
4 changed files with 86 additions and 11 deletions

View File

@@ -170,6 +170,7 @@ context::context( main_context_t) :
terminated_hook_(),
ready_hook_(),
remote_ready_hook_(),
yield_hook_(),
sleep_hook_(),
wait_hook_(),
tp_( (std::chrono::steady_clock::time_point::max)() ),
@@ -197,6 +198,7 @@ context::context( dispatcher_context_t, boost::context::preallocated const& pall
terminated_hook_(),
ready_hook_(),
remote_ready_hook_(),
yield_hook_(),
sleep_hook_(),
wait_hook_(),
tp_( (std::chrono::steady_clock::time_point::max)() ),
@@ -418,6 +420,12 @@ context::remote_ready_is_linked() {
return remote_ready_hook_.is_linked();
}
bool
context::yield_is_linked() {
std::unique_lock< detail::spinlock > lk( hook_splk_);
return yield_hook_.is_linked();
}
bool
context::sleep_is_linked() {
std::unique_lock< detail::spinlock > lk( hook_splk_);
@@ -448,6 +456,12 @@ context::remote_ready_unlink() {
remote_ready_hook_.unlink();
}
void
context::yield_unlink() {
std::unique_lock< detail::spinlock > lk( hook_splk_);
yield_hook_.unlink();
}
void
context::sleep_unlink() {
std::unique_lock< detail::spinlock > lk( hook_splk_);