|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r57740 - in sandbox/fiber: boost boost/fiber boost/fiber/detail libs/fiber/build libs/fiber/src libs/fiber/test
From: oliver.kowalke_at_[hidden]
Date: 2009-11-18 05:00:57
Author: olli
Date: 2009-11-18 05:00:53 EST (Wed, 18 Nov 2009)
New Revision: 57740
URL: http://svn.boost.org/trac/boost/changeset/57740
Log:
- attributes removed
Removed:
sandbox/fiber/boost/fiber/attributes.hpp
sandbox/fiber/libs/fiber/src/attributes.cpp
Text files modified:
sandbox/fiber/boost/fiber.hpp | 1
sandbox/fiber/boost/fiber/detail/fiber_info.hpp | 23 +++++++-------
sandbox/fiber/boost/fiber/detail/fiber_info_base_posix.hpp | 13 ++++---
sandbox/fiber/boost/fiber/detail/fiber_info_base_windows.hpp | 21 +++++++------
sandbox/fiber/boost/fiber/fiber.hpp | 61 ++++++++++++++++++++-------------------
sandbox/fiber/boost/fiber/scheduler.hpp | 9 ++---
sandbox/fiber/libs/fiber/build/Jamfile.v2 | 2 -
sandbox/fiber/libs/fiber/src/fiber.cpp | 15 +++++++--
sandbox/fiber/libs/fiber/src/fiber_info_base_posix.cpp | 12 ++++---
sandbox/fiber/libs/fiber/src/fiber_info_base_windows.cpp | 8 +++-
sandbox/fiber/libs/fiber/src/fiber_windows.cpp | 2
sandbox/fiber/libs/fiber/src/scheduler_impl.cpp | 2
sandbox/fiber/libs/fiber/test/test_interrupt.cpp | 5 +++
13 files changed, 96 insertions(+), 78 deletions(-)
Modified: sandbox/fiber/boost/fiber.hpp
==============================================================================
--- sandbox/fiber/boost/fiber.hpp (original)
+++ sandbox/fiber/boost/fiber.hpp 2009-11-18 05:00:53 EST (Wed, 18 Nov 2009)
@@ -7,7 +7,6 @@
#ifndef BOOST_FIBER_H
#define BOOST_FIBER_H
-#include <boost/fiber/attributes.hpp>
#include <boost/fiber/auto_reset_event.hpp>
#include <boost/fiber/bounded_fifo.hpp>
#include <boost/fiber/condition.hpp>
Deleted: sandbox/fiber/boost/fiber/attributes.hpp
==============================================================================
--- sandbox/fiber/boost/fiber/attributes.hpp 2009-11-18 05:00:53 EST (Wed, 18 Nov 2009)
+++ (empty file)
@@ -1,41 +0,0 @@
-
-// Copyright Oliver Kowalke 2009.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef BOOST_FIBERS_ATTRIBUTES_H
-#define BOOST_FIBERS_ATTRIBUTES_H
-
-#include <cstddef>
-
-#include <boost/fiber/detail/config.hpp>
-
-#include <boost/config/abi_prefix.hpp>
-
-namespace boost {
-namespace fibers {
-
-class BOOST_FIBER_DECL attributes
-{
-private:
- std::size_t stacksize_;
- int priority_;
-
-public:
- attributes();
-
- void stack_size( std::size_t);
-
- std::size_t stack_size() const;
-
- void priority( int);
-
- int priority() const;
-};
-
-}}
-
-#include <boost/config/abi_suffix.hpp>
-
-#endif // BOOST_FIBERS_ATTRIBUTES_H
Modified: sandbox/fiber/boost/fiber/detail/fiber_info.hpp
==============================================================================
--- sandbox/fiber/boost/fiber/detail/fiber_info.hpp (original)
+++ sandbox/fiber/boost/fiber/detail/fiber_info.hpp 2009-11-18 05:00:53 EST (Wed, 18 Nov 2009)
@@ -7,11 +7,12 @@
#ifndef BOOST_FIBERS_DETAIL_FIBER_INFO_H
#define BOOST_FIBERS_DETAIL_FIBER_INFO_H
+#include <cstddef>
+
#include <boost/assert.hpp>
#include <boost/config.hpp>
#include <boost/type_traits/remove_reference.hpp>
-#include <boost/fiber/attributes.hpp>
#include <boost/fiber/detail/config.hpp>
#include <boost/fiber/detail/fiber_info_base.hpp>
#include <boost/fiber/detail/move.hpp>
@@ -48,18 +49,18 @@
public:
#ifdef BOOST_HAS_RVALUE_REFS
- thread_data( Fn && fn, attributes const& attribs) :
- fiber_info_base( attribs),
+ thread_data( Fn && fn, std::size_t stack_size) :
+ fiber_info_base( stack_size),
fn_( static_cast< Fn && >( fn) )
{}
#else
- fiber_info( Fn fn, attributes const& attribs) :
- fiber_info_base( attribs),
+ fiber_info( Fn fn, std::size_t stack_size) :
+ fiber_info_base( stack_size),
fn_( fn)
{}
- fiber_info( boost::detail::fiber_move_t< Fn > fn, attributes const& attribs) :
- fiber_info_base( attribs),
+ fiber_info( boost::detail::fiber_move_t< Fn > fn, std::size_t stack_size) :
+ fiber_info_base( stack_size),
fn_( fn)
{}
#endif
@@ -78,8 +79,8 @@
fiber_info & operator=( fiber_info const&);
public:
- fiber_info( reference_wrapper< Fn > fn, attributes const& attribs) :
- fiber_info_base( attribs),
+ fiber_info( reference_wrapper< Fn > fn, std::size_t stack_size) :
+ fiber_info_base( stack_size),
fn_( fn)
{}
@@ -97,8 +98,8 @@
fiber_info & operator=( fiber_info const&);
public:
- fiber_info( const reference_wrapper< Fn > fn, attributes const& attribs) :
- fiber_info_base( attribs),
+ fiber_info( const reference_wrapper< Fn > fn, std::size_t stack_size) :
+ fiber_info_base( stack_size),
fn_( fn)
{}
Modified: sandbox/fiber/boost/fiber/detail/fiber_info_base_posix.hpp
==============================================================================
--- sandbox/fiber/boost/fiber/detail/fiber_info_base_posix.hpp (original)
+++ sandbox/fiber/boost/fiber/detail/fiber_info_base_posix.hpp 2009-11-18 05:00:53 EST (Wed, 18 Nov 2009)
@@ -13,6 +13,7 @@
}
+#include <cstddef>
#include <stack>
#include <boost/cstdint.hpp>
@@ -20,7 +21,6 @@
#include <boost/intrusive_ptr.hpp>
#include <boost/shared_array.hpp>
-#include <boost/fiber/attributes.hpp>
#include <boost/fiber/detail/config.hpp>
#include <boost/fiber/detail/fiber_state.hpp>
@@ -33,20 +33,21 @@
struct BOOST_FIBER_DECL fiber_info_base
{
typedef intrusive_ptr< fiber_info_base > ptr_t;
- typedef function< void() > callable_t;
- typedef std::stack< callable_t > callable_stack_t;
+ typedef function< void() > callable_t;
+ typedef std::stack< callable_t > callable_stack_t;
uint32_t use_count;
- attributes attrs;
+ std::size_t stack_size;
+ int priority;
::ucontext_t uctx;
shared_array< char > uctx_stack;
fiber_state_t state;
- fiber_interrupt_t interrupt;
+ fiber_interrupt_t interrupt;
callable_stack_t at_exit;
fiber_info_base();
- fiber_info_base( attributes const&);
+ fiber_info_base( std::size_t);
virtual ~fiber_info_base() {}
Modified: sandbox/fiber/boost/fiber/detail/fiber_info_base_windows.hpp
==============================================================================
--- sandbox/fiber/boost/fiber/detail/fiber_info_base_windows.hpp (original)
+++ sandbox/fiber/boost/fiber/detail/fiber_info_base_windows.hpp 2009-11-18 05:00:53 EST (Wed, 18 Nov 2009)
@@ -13,13 +13,13 @@
}
+#include <cstddef>
#include <stack>
#include <boost/cstdint.hpp>
#include <boost/function.hpp>
#include <boost/intrusive_ptr.hpp>
-#include <boost/fiber/attributes.hpp>
#include <boost/fiber/detail/config.hpp>
#include <boost/fiber/detail/fiber_state.hpp>
@@ -37,19 +37,20 @@
struct BOOST_FIBER_DECL fiber_info_base
{
typedef intrusive_ptr< fiber_info_base > ptr_t;
- typedef function< void() > callable_t;
- typedef std::stack< callable_t > callable_stack_t;
+ typedef function< void() > callable_t;
+ typedef std::stack< callable_t > callable_stack_t;
- uint32_t use_count;
- attributes attrs;
- LPVOID uctx;
- fiber_state_t state;
- fiber_interrupt_t interrupt;
- callable_stack_t at_exit;
+ uint32_t use_count;
+ std::size_t stacksize_;
+ int priority_;
+ LPVOID uctx;
+ fiber_state_t state;
+ fiber_interrupt_t interrupt;
+ callable_stack_t at_exit;
fiber_info_base();
- fiber_info_base( attributes const&);
+ fiber_info_base( std::size_t);
virtual ~fiber_info_base();
Modified: sandbox/fiber/boost/fiber/fiber.hpp
==============================================================================
--- sandbox/fiber/boost/fiber/fiber.hpp (original)
+++ sandbox/fiber/boost/fiber/fiber.hpp 2009-11-18 05:00:53 EST (Wed, 18 Nov 2009)
@@ -7,6 +7,7 @@
#ifndef BOOST_FIBERS_FIBER_H
#define BOOST_FIBERS_FIBER_H
+#include <cstddef>
#include <iostream>
#include <boost/bind.hpp>
@@ -16,7 +17,6 @@
#include <boost/utility/enable_if.hpp>
#include <boost/utility.hpp>
-#include <boost/fiber/attributes.hpp>
#include <boost/fiber/detail/config.hpp>
#include <boost/fiber/detail/fiber_info.hpp>
#include <boost/fiber/detail/move.hpp>
@@ -39,6 +39,8 @@
class disable_interruption;
class restore_interruption;
+#define BOOST_FIBER_DEFAULT_STACKSIZE 64000
+
class BOOST_FIBER_DECL fiber
{
private:
@@ -59,31 +61,30 @@
#ifdef BOOST_HAS_RVALUE_REFS
template< typename Fn >
static detail::fiber_info_base::ptr_t make_info_(
- attributes attrs, Fn && fn)
+ std::size_t stack_size, Fn && fn)
{
return detail::fiber_info_base::ptr_t(
new detail::fiber_info< typename remove_reference< Fn >::type >(
- static_cast< Fn && >( fn), attrs) );
+ static_cast< Fn && >( fn), stack_size) );
}
static detail::fiber_info_base::ptr_t make_info_(
- attributes attrs, void ( * fn)() );
+ std::size_t stack_size, void ( * fn)() );
#else
template< typename Fn >
static detail::fiber_info_base::ptr_t make_info_(
- attributes attrs, Fn fn)
+ std::size_t stack_size, Fn fn)
{
return detail::fiber_info_base::ptr_t(
- new detail::fiber_info< Fn >( fn, attrs) );
+ new detail::fiber_info< Fn >( fn, stack_size) );
}
template< typename Fn >
static detail::fiber_info_base::ptr_t make_info_(
- attributes attrs,
- boost::detail::fiber_move_t< Fn > fn)
+ std::size_t stack_size, boost::detail::fiber_move_t< Fn > fn)
{
return detail::fiber_info_base::ptr_t(
- new detail::fiber_info< Fn >( fn, attrs) );
+ new detail::fiber_info< Fn >( fn, stack_size) );
}
#endif
@@ -98,11 +99,11 @@
#ifdef BOOST_HAS_RVALUE_REFS
template< typename Fn >
fiber( Fn && fn) :
- info_( make_info_( attributes(), static_cast< Fn && >( fn) ) )
+ info_( make_info_( BOOST_FIBER_DEFAULT_STACKSIZE, static_cast< Fn && >( fn) ) )
{ init_(); }
- fiber( attributes attrs, Fn && fn) :
- info_( make_info_( attrs, static_cast< Fn && >( fn) ) )
+ fiber( std::size_t stack_size, Fn && fn) :
+ info_( make_info_( stack_size, static_cast< Fn && >( fn) ) )
{ init_(); }
fiber( fiber &&);
@@ -114,37 +115,36 @@
#ifdef BOOST_NO_SFINAE
template< typename Fn >
explicit fiber( Fn fn) :
- info_( make_info_( attributes(), fn) )
+ info_( make_info_( BOOST_FIBER_DEFAULT_STACKSIZE, fn) )
{ init_(); }
template< typename Fn >
- explicit fiber( attributes attrs, Fn fn) :
- info_( make_info_( attrs, fn) )
+ explicit fiber( std::size_t stack_size, Fn fn) :
+ info_( make_info_( stack_size, fn) )
{ init_(); }
#else
template< typename Fn >
explicit fiber(
Fn fn,
typename disable_if< boost::is_convertible< Fn &, boost::detail::fiber_move_t< Fn > >, dummy * >::type = 0) :
- info_( make_info_( attributes(), fn) )
+ info_( make_info_( BOOST_FIBER_DEFAULT_STACKSIZE, fn) )
{ init_(); }
template< typename Fn >
explicit fiber(
- attributes attrs,
- Fn fn,
+ std::size_t stack_size, Fn fn,
typename disable_if< boost::is_convertible< Fn &, boost::detail::fiber_move_t< Fn > >, dummy * >::type = 0) :
- info_( make_info_( attrs, fn) )
+ info_( make_info_( stack_size, fn) )
{ init_(); }
#endif
template< typename Fn >
explicit fiber( boost::detail::fiber_move_t< Fn > fn) :
- info_( make_info_( attributes(), fn) )
+ info_( make_info_( BOOST_FIBER_DEFAULT_STACKSIZE, fn) )
{ init_(); }
template< typename Fn >
- explicit fiber( attributes attrs, boost::detail::fiber_move_t< Fn > fn) :
- info_( make_info_( attrs, fn) )
+ explicit fiber( std::size_t stack_size, boost::detail::fiber_move_t< Fn > fn) :
+ info_( make_info_( stack_size, fn) )
{ init_(); }
fiber( boost::detail::fiber_move_t< fiber >);
@@ -165,14 +165,14 @@
fiber( Fn fn, BOOST_ENUM_FIBER_ARGS(n)) : \
info_( \
make_info_( \
- attributes(), \
+ BOOST_FIBER_DEFAULT_STACKSIZE, \
boost::bind( boost::type< void >(), fn, BOOST_PP_ENUM_PARAMS(n, a)) ) ) \
{ init_(); } \
template< typename Fn, BOOST_PP_ENUM_PARAMS(n, typename A) > \
- fiber( attributes attrs, Fn fn, BOOST_ENUM_FIBER_ARGS(n)) : \
+ fiber( std::size_t stack_size, Fn fn, BOOST_ENUM_FIBER_ARGS(n)) : \
info_( \
make_info_( \
- attrs, \
+ stack_size, \
boost::bind( boost::type< void >(), fn, BOOST_PP_ENUM_PARAMS(n, a)) ) ) \
{ init_(); }
@@ -204,6 +204,7 @@
void priority( int);
void interrupt();
+ bool interruption_requested() const;
void cancel();
@@ -264,16 +265,16 @@
{ return fiber( fn); }
template< typename Fn >
-fiber make_fiber( attributes attrs, Fn fn)
-{ return fiber( attrs, fn); }
+fiber make_fiber( std::size_t stack_size, Fn fn)
+{ return fiber( stack_size, fn); }
#define BOOST_FIBER_make_info_FUNCTION(z, n, unused) \
template< typename Fn, BOOST_PP_ENUM_PARAMS(n, typename A) > \
fiber make_fiber( Fn fn, BOOST_ENUM_FIBER_ARGS(n)) \
{ return fiber( fn, BOOST_PP_ENUM_PARAMS(n, a) ); } \
template< typename Fn, BOOST_PP_ENUM_PARAMS(n, typename A) > \
-fiber make_fiber( attributes attrs, Fn fn, BOOST_ENUM_FIBER_ARGS(n)) \
-{ return fiber( attrs, fn, BOOST_PP_ENUM_PARAMS(n, a) ); }
+fiber make_fiber( std::size_t stack_size, Fn fn, BOOST_ENUM_FIBER_ARGS(n)) \
+{ return fiber( stack_size, fn, BOOST_PP_ENUM_PARAMS(n, a) ); }
BOOST_PP_REPEAT_FROM_TO( 1, BOOST_FIBER_MAX_ARITY, BOOST_FIBER_make_info_FUNCTION, ~)
@@ -282,6 +283,8 @@
#undef BOOST_FIBER_ARG
#undef BOOST_FIBER_MAX_ARITY
+#undef BOOST_FIBER_DEFAULT_STACKSIZE
+
}
using fibers::fiber;
Modified: sandbox/fiber/boost/fiber/scheduler.hpp
==============================================================================
--- sandbox/fiber/boost/fiber/scheduler.hpp (original)
+++ sandbox/fiber/boost/fiber/scheduler.hpp 2009-11-18 05:00:53 EST (Wed, 18 Nov 2009)
@@ -15,7 +15,6 @@
#include <boost/thread/tss.hpp>
#include <boost/utility.hpp>
-#include <boost/fiber/attributes.hpp>
#include <boost/fiber/detail/config.hpp>
#include <boost/fiber/detail/fiber_state.hpp>
#include <boost/fiber/detail/scheduler_impl.hpp>
@@ -132,8 +131,8 @@
{ access_()->add_fiber( fiber( fn) ); }
template< typename Fn >
- void make_fiber( attributes attrs, Fn fn)
- { access_()->add_fiber( fiber( attrs, fn) ); }
+ void make_fiber( std::size_t stack_size, Fn fn)
+ { access_()->add_fiber( fiber( stack_size, fn) ); }
#ifndef BOOST_FIBER_MAX_ARITY
#define BOOST_FIBER_MAX_ARITY 10
@@ -148,8 +147,8 @@
void make_fiber( Fn fn, BOOST_ENUM_FIBER_ARGS(n)) \
{ access_()->add_fiber( fiber( fn, BOOST_PP_ENUM_PARAMS(n, a) ) ); } \
template< typename Fn, BOOST_PP_ENUM_PARAMS(n, typename A) > \
- void make_fiber( attributes const& attrs, Fn fn, BOOST_ENUM_FIBER_ARGS(n)) \
- { access_()->add_fiber( fiber( attrs, fn, BOOST_PP_ENUM_PARAMS(n, a) ) ); }
+ void make_fiber( std::size_t stack_size, Fn fn, BOOST_ENUM_FIBER_ARGS(n)) \
+ { access_()->add_fiber( fiber( stack_size, fn, BOOST_PP_ENUM_PARAMS(n, a) ) ); }
BOOST_PP_REPEAT_FROM_TO( 1, BOOST_FIBER_MAX_ARITY, BOOST_FIBER_MAKE_FIBER_FUNCTION, ~)
Modified: sandbox/fiber/libs/fiber/build/Jamfile.v2
==============================================================================
--- sandbox/fiber/libs/fiber/build/Jamfile.v2 (original)
+++ sandbox/fiber/libs/fiber/build/Jamfile.v2 2009-11-18 05:00:53 EST (Wed, 18 Nov 2009)
@@ -41,7 +41,6 @@
alias fiber_sources
: ## win32 sources ##
- attributes.cpp
auto_reset_event.cpp
condition.cpp
count_down_event.cpp
@@ -58,7 +57,6 @@
alias fiber_sources
: ## posix sources ##
- attributes.cpp
auto_reset_event.cpp
condition.cpp
count_down_event.cpp
Deleted: sandbox/fiber/libs/fiber/src/attributes.cpp
==============================================================================
--- sandbox/fiber/libs/fiber/src/attributes.cpp 2009-11-18 05:00:53 EST (Wed, 18 Nov 2009)
+++ (empty file)
@@ -1,43 +0,0 @@
-
-// Copyright Oliver Kowalke 2009.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#include <boost/fiber/attributes.hpp>
-
-#include <boost/fiber/exceptions.hpp>
-
-#include <boost/config/abi_prefix.hpp>
-
-namespace boost {
-namespace fibers {
-
-attributes::attributes() :
- stacksize_( 64000),
- priority_( 0)
-{}
-
-void
-attributes::stack_size( std::size_t value)
-{
- if ( value < 1)
- throw invalid_stacksize();
- stacksize_ = value;
-}
-
-std::size_t
-attributes::stack_size() const
-{ return stacksize_; }
-
-void
-attributes::priority( int value)
-{ priority_ = value; }
-
-int
-attributes::priority() const
-{ return priority_; }
-
-}}
-
-#include <boost/config/abi_suffix.hpp>
Modified: sandbox/fiber/libs/fiber/src/fiber.cpp
==============================================================================
--- sandbox/fiber/libs/fiber/src/fiber.cpp (original)
+++ sandbox/fiber/libs/fiber/src/fiber.cpp 2009-11-18 05:00:53 EST (Wed, 18 Nov 2009)
@@ -19,10 +19,10 @@
#ifdef BOOST_HAS_RVALUE_REFS
detail::fiber_info_base::ptr_t
-fiber::make_info_( attributes attrs, void ( * fn)() )
+fiber::make_info_( std::size_t stack_size, void ( * fn)() )
{
return detail::fiber_info_base::ptr_t(
- new detail::fiber_info< void( *)() >( fn, attrs) );
+ new detail::fiber_info< void( *)() >( fn, stack_size) );
}
#endif
@@ -108,14 +108,14 @@
fiber::priority() const
{
if ( ! info_) throw fiber_moved();
- return info_->attrs.priority();
+ return info_->priority;
}
void
fiber::priority( int prio)
{
if ( ! info_) throw fiber_moved();
- info_->attrs.priority( prio);
+ info_->priority = prio;
if ( is_alive() ) scheduler::reschedule_fiber( get_id() );
}
@@ -127,6 +127,13 @@
info_->interrupt |= detail::INTERRUPTION_ENABLED;
}
+bool
+fiber::interruption_requested() const
+{
+ if ( ! info_) throw fiber_moved();
+ return ( info_->interrupt & detail::INTERRUPTION_ENABLED) != 0;
+}
+
void
fiber::cancel()
{ scheduler::cancel_fiber( get_id() ); }
Modified: sandbox/fiber/libs/fiber/src/fiber_info_base_posix.cpp
==============================================================================
--- sandbox/fiber/libs/fiber/src/fiber_info_base_posix.cpp (original)
+++ sandbox/fiber/libs/fiber/src/fiber_info_base_posix.cpp 2009-11-18 05:00:53 EST (Wed, 18 Nov 2009)
@@ -19,7 +19,8 @@
fiber_info_base::fiber_info_base() :
use_count( 0),
- attrs(),
+ stack_size( 0),
+ priority( 0),
uctx(),
uctx_stack(),
state( STATE_MASTER),
@@ -27,11 +28,12 @@
at_exit()
{}
-fiber_info_base::fiber_info_base( attributes const& attrs_) :
+fiber_info_base::fiber_info_base( std::size_t stack_size_) :
use_count( 0),
- attrs( attrs_),
+ stack_size( stack_size_),
+ priority( 0),
uctx(),
- uctx_stack( new char[attrs.stack_size()]),
+ uctx_stack( new char[stack_size]),
state( STATE_NOT_STARTED),
interrupt( INTERRUPTION_DISABLED)
{
@@ -43,7 +45,7 @@
errno,
system::system_category) );
uctx.uc_stack.ss_sp = uctx_stack.get();
- uctx.uc_stack.ss_size = attrs.stack_size();
+ uctx.uc_stack.ss_size = stack_size;
uctx.uc_link = 0;
}
Modified: sandbox/fiber/libs/fiber/src/fiber_info_base_windows.cpp
==============================================================================
--- sandbox/fiber/libs/fiber/src/fiber_info_base_windows.cpp (original)
+++ sandbox/fiber/libs/fiber/src/fiber_info_base_windows.cpp 2009-11-18 05:00:53 EST (Wed, 18 Nov 2009)
@@ -19,7 +19,8 @@
fiber_info_base::fiber_info_base() :
use_count( 0),
- attrs(),
+ stack_size( 0),
+ priority( 0),
uctx(),
state( STATE_MASTER),
interrupt( INTERRUPTION_DISABLED),
@@ -36,9 +37,10 @@
fiber_info_base::~fiber_info_base()
{ if ( state != STATE_MASTER) ::DeleteFiber( uctx); }
-fiber_info_base::fiber_info_base( attributes const& attrs_) :
+fiber_info_base::fiber_info_base( std::size_t stack_size_) :
use_count( 0),
- attrs( attrs_),
+ stack_size( stack_size_),
+ priority( 0),
uctx(),
state( STATE_NOT_STARTED),
interrupt( INTERRUPTION_DISABLED)
Modified: sandbox/fiber/libs/fiber/src/fiber_windows.cpp
==============================================================================
--- sandbox/fiber/libs/fiber/src/fiber_windows.cpp (original)
+++ sandbox/fiber/libs/fiber/src/fiber_windows.cpp 2009-11-18 05:00:53 EST (Wed, 18 Nov 2009)
@@ -49,7 +49,7 @@
if ( ! info_) throw fiber_moved();
info_->uctx = ::CreateFiber(
- info_->attrs.stack_size(),
+ info_->stack_size,
static_cast< LPFIBER_START_ROUTINE >( & trampoline),
static_cast< LPVOID >( info_.get() ) );
}
Modified: sandbox/fiber/libs/fiber/src/scheduler_impl.cpp
==============================================================================
--- sandbox/fiber/libs/fiber/src/scheduler_impl.cpp (original)
+++ sandbox/fiber/libs/fiber/src/scheduler_impl.cpp 2009-11-18 05:00:53 EST (Wed, 18 Nov 2009)
@@ -145,7 +145,7 @@
BOOST_ASSERT( ! HAS_STATE_MASTER( active_.info_->state) );
BOOST_ASSERT( STATE_RUNNING == active_.info_->state);
- return ( active_.info_->interrupt & detail::INTERRUPTION_ENABLED) != 0;
+ return active_.interruption_requested();
}
bool
Modified: sandbox/fiber/libs/fiber/test/test_interrupt.cpp
==============================================================================
--- sandbox/fiber/libs/fiber/test/test_interrupt.cpp (original)
+++ sandbox/fiber/libs/fiber/test/test_interrupt.cpp 2009-11-18 05:00:53 EST (Wed, 18 Nov 2009)
@@ -70,6 +70,11 @@
{
++value2;
if ( i == 1) f.interrupt();
+ if ( i >= 1)
+ {
+ if ( ! f.interruption_requested() )
+ throw std::logic_error("");
+ }
boost::this_fiber::yield();
}
}
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk