+ while ( true) {
+ if ( std::chrono::steady_clock::now() > timeout_time) {
+ return false;
+ }
+ context * active_ctx = context::active();
+ // store this fiber in order to be notified later
+ detail::spinlock_lock lk{ wait_queue_splk_ };
+ if ( nullptr == owner_) {
+ owner_ = active_ctx;
+ return true;
+ }
+ BOOST_ASSERT( ! active_ctx->wait_is_linked() );
+ active_ctx->wait_link( wait_queue_);
+ intrusive_ptr_add_ref( active_ctx);
+ active_ctx->twstatus.store( reinterpret_cast< std::intptr_t >( this), std::memory_order_release);
+ // suspend this fiber until notified or timed-out
+ if ( ! active_ctx->wait_until( timeout_time, lk) ) {
+ // remove fiber from wait-queue
+ lk.lock();
+ wait_queue_.remove( * active_ctx);
+ return false;
+ }
+ BOOST_ASSERT( ! active_ctx->wait_is_linked() );