mirror of
https://github.com/boostorg/fiber.git
synced 2026-02-13 00:12:17 +00:00
use C++11
This commit is contained in:
@@ -8,13 +8,9 @@
|
||||
|
||||
#include "boost/fiber/interruption.hpp"
|
||||
|
||||
#include <boost/throw_exception.hpp>
|
||||
|
||||
#include "boost/fiber/detail/fiber_base.hpp"
|
||||
#include "boost/fiber/detail/interrupt_flags.hpp"
|
||||
#include "boost/fiber/fiber_manager.hpp"
|
||||
#include "boost/fiber/exceptions.hpp"
|
||||
#include "boost/fiber/operations.hpp"
|
||||
|
||||
#ifdef BOOST_HAS_ABI_HEADERS
|
||||
# include BOOST_ABI_PREFIX
|
||||
@@ -23,51 +19,44 @@
|
||||
namespace boost {
|
||||
namespace this_fiber {
|
||||
|
||||
disable_interruption::disable_interruption() BOOST_NOEXCEPT :
|
||||
set_( ( fibers::fm_active()->interruption_blocked() ) )
|
||||
{
|
||||
if ( ! set_)
|
||||
disable_interruption::disable_interruption() noexcept :
|
||||
set_( ( fibers::fm_active()->interruption_blocked() ) ) {
|
||||
if ( ! set_) {
|
||||
fibers::fm_active()->interruption_blocked( true);
|
||||
}
|
||||
}
|
||||
|
||||
disable_interruption::~disable_interruption() BOOST_NOEXCEPT
|
||||
{
|
||||
if ( ! set_)
|
||||
disable_interruption::~disable_interruption() noexcept {
|
||||
if ( ! set_) {
|
||||
fibers::fm_active()->interruption_blocked( false);
|
||||
}
|
||||
}
|
||||
|
||||
restore_interruption::restore_interruption( disable_interruption & disabler) BOOST_NOEXCEPT :
|
||||
disabler_( disabler)
|
||||
{
|
||||
if ( ! disabler_.set_)
|
||||
restore_interruption::restore_interruption( disable_interruption & disabler) noexcept :
|
||||
disabler_( disabler) {
|
||||
if ( ! disabler_.set_) {
|
||||
fibers::fm_active()->interruption_blocked( false);
|
||||
}
|
||||
}
|
||||
|
||||
restore_interruption::~restore_interruption() BOOST_NOEXCEPT
|
||||
{
|
||||
if ( ! disabler_.set_)
|
||||
restore_interruption::~restore_interruption() noexcept {
|
||||
if ( ! disabler_.set_) {
|
||||
fibers::fm_active()->interruption_blocked( true);
|
||||
}
|
||||
}
|
||||
|
||||
bool interruption_enabled() BOOST_NOEXCEPT
|
||||
{
|
||||
fibers::detail::fiber_base * f = fibers::fm_active();
|
||||
return 0 != f && ! f->interruption_blocked();
|
||||
bool interruption_enabled() noexcept {
|
||||
return ! fibers::fm_active()->interruption_blocked();
|
||||
}
|
||||
|
||||
bool interruption_requested() BOOST_NOEXCEPT
|
||||
{
|
||||
fibers::detail::fiber_base * f = fibers::fm_active();
|
||||
if ( 0 == f) return false;
|
||||
return f->interruption_requested();
|
||||
bool interruption_requested() noexcept {
|
||||
return fibers::fm_active()->interruption_requested();
|
||||
}
|
||||
|
||||
void interruption_point()
|
||||
{
|
||||
if ( interruption_requested() && interruption_enabled() )
|
||||
{
|
||||
void interruption_point() {
|
||||
if ( interruption_requested() && interruption_enabled() ) {
|
||||
fibers::fm_active()->request_interruption( false);
|
||||
boost::throw_exception( fibers::fiber_interrupted() );
|
||||
throw fibers::fiber_interrupted();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user