#else
fiber = ::ConvertThreadToFiber( nullptr);
if ( BOOST_UNLIKELY( nullptr == fiber) ) {
- DWORD err = ::GetLastError();
- BOOST_ASSERT( ERROR_ALREADY_FIBER == err);
+ BOOST_ASSERT( ERROR_ALREADY_FIBER == ::GetLastError());
fiber = ::GetCurrentFiber();
BOOST_ASSERT( nullptr != fiber);
BOOST_ASSERT( reinterpret_cast< LPVOID >( 0x1E00) != fiber);
};
struct forced_unwind {
- fiber_activation_record * from{ nullptr };
+ fiber_activation_record * from{ nullptr };
+#ifndef BOOST_ASSERT_IS_VOID
+ bool caught{ false };
+#endif
explicit forced_unwind( fiber_activation_record * from_) :
from{ from_ } {
}
+
+#ifndef BOOST_ASSERT_IS_VOID
+ ~forced_unwind() {
+ BOOST_ASSERT( caught);
+ }
+#endif
};
template< typename Ctx, typename StackAlloc, typename Fn >
#endif
} catch ( forced_unwind const& ex) {
c = Ctx{ ex.from };
+#ifndef BOOST_ASSERT_IS_VOID
+ const_cast< forced_unwind & >( ex).caught = true;
+#endif
}
// this context has finished its task
from = nullptr;
return nullptr == ptr_ || ptr_->terminated;
}
- bool operator==( fiber const& other) const noexcept {
- return ptr_ == other.ptr_;
- }
-
- bool operator!=( fiber const& other) const noexcept {
- return ptr_ != other.ptr_;
- }
-
bool operator<( fiber const& other) const noexcept {
return ptr_ < other.ptr_;
}
- bool operator>( fiber const& other) const noexcept {
- return other.ptr_ < ptr_;
- }
-
- bool operator<=( fiber const& other) const noexcept {
- return ! ( * this > other);
- }
-
- bool operator>=( fiber const& other) const noexcept {
- return ! ( * this < other);
- }
-
template< typename charT, class traitsT >
friend std::basic_ostream< charT, traitsT > &
operator<<( std::basic_ostream< charT, traitsT > & os, fiber const& other) {
l.swap( r);
}
+typedef fiber fiber_context;
+
}}
#if defined(BOOST_MSVC)