Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r58617 - in sandbox/fiber/libs/fiber/src: . detail
From: oliver.kowalke_at_[hidden]
Date: 2010-01-01 13:01:43


Author: olli
Date: 2010-01-01 13:01:42 EST (Fri, 01 Jan 2010)
New Revision: 58617
URL: http://svn.boost.org/trac/boost/changeset/58617

Log:
- see previous post

Added:
   sandbox/fiber/libs/fiber/src/detail/
   sandbox/fiber/libs/fiber/src/detail/fiber_posix.cpp (contents, props changed)
   sandbox/fiber/libs/fiber/src/detail/fiber_windows.cpp (contents, props changed)
   sandbox/fiber/libs/fiber/src/detail/info_base_posix.cpp (contents, props changed)
   sandbox/fiber/libs/fiber/src/detail/info_base_windows.cpp (contents, props changed)
Removed:
   sandbox/fiber/libs/fiber/src/fiber_posix.cpp
   sandbox/fiber/libs/fiber/src/fiber_windows.cpp
   sandbox/fiber/libs/fiber/src/info_base_posix.cpp
   sandbox/fiber/libs/fiber/src/info_base_windows.cpp

Added: sandbox/fiber/libs/fiber/src/detail/fiber_posix.cpp
==============================================================================
--- (empty file)
+++ sandbox/fiber/libs/fiber/src/detail/fiber_posix.cpp 2010-01-01 13:01:42 EST (Fri, 01 Jan 2010)
@@ -0,0 +1,82 @@
+
+// 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/fiber.hpp>
+
+extern "C" {
+
+#include <ucontext.h>
+
+}
+
+#include <cerrno>
+
+#include <boost/system/system_error.hpp>
+
+#include <boost/fiber/exceptions.hpp>
+#include <boost/fiber/utility.hpp>
+
+#include <boost/config/abi_prefix.hpp>
+
+namespace boost {
+namespace fibers {
+
+void trampoline( detail::info_base * self)
+{
+ BOOST_ASSERT( self);
+ try
+ { self->run(); }
+ catch ( fiber_interrupted const&) {}
+ catch (...) {}
+ while ( ! self->at_exit.empty() )
+ {
+ detail::info_base::callable_t ca;
+ self->at_exit.top().swap( ca);
+ self->at_exit.pop();
+ ca();
+ }
+ this_fiber::cancel();
+}
+
+void
+fiber::init_()
+{
+ typedef void fn_type( detail::info_base *);
+ typedef void ( * st_fn)();
+ fn_type * fn_ptr( trampoline);
+
+ if ( ! info_) throw fiber_moved();
+
+ ::makecontext(
+ & info_->uctx,
+ ( st_fn)( fn_ptr),
+ 1,
+ info_.get() );
+}
+
+void
+fiber::switch_to_( fiber & to)
+{
+ if ( ! info_ || ! to.info_) throw fiber_moved();
+
+ if ( ::swapcontext( & info_->uctx, & to.info_->uctx) != 0)
+ throw system::system_error(
+ system::error_code(
+ errno,
+ system::system_category) );
+}
+
+void
+fiber::convert_thread_to_fiber()
+{}
+
+void
+fiber::convert_fiber_to_thread()
+{}
+
+}}
+
+#include <boost/config/abi_suffix.hpp>

Added: sandbox/fiber/libs/fiber/src/detail/fiber_windows.cpp
==============================================================================
--- (empty file)
+++ sandbox/fiber/libs/fiber/src/detail/fiber_windows.cpp 2010-01-01 13:01:42 EST (Fri, 01 Jan 2010)
@@ -0,0 +1,103 @@
+
+// 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/fiber.hpp>
+
+extern "C" {
+
+#include <windows.h>
+
+}
+
+#include <cerrno>
+
+#include <boost/system/system_error.hpp>
+
+#include <boost/fiber/exceptions.hpp>
+#include <boost/fiber/utility.hpp>
+
+#include <boost/config/abi_prefix.hpp>
+
+namespace {
+
+bool is_thread_a_fiber()
+{
+#if ( _WIN32_WINNT > 0x0600)
+ return ::IsThreadAFiber() == TRUE;
+#else
+ LPVOID current = ::GetCurrentFiber();
+ return 0 != current && current != reinterpret_cast< LPVOID >( 0x1E00);
+#endif
+}
+
+}
+
+namespace boost {
+namespace fibers {
+
+VOID CALLBACK trampoline( LPVOID vp)
+{
+ detail::info_base * self(
+ static_cast< detail::info_base * >( vp) );
+ BOOST_ASSERT( self);
+ try
+ { self->run(); }
+ catch ( fiber_interrupted const&) {}
+ catch (...) {}
+ while ( ! self->at_exit.empty() )
+ {
+ detail::info_base::callable_t ca;
+ self->at_exit.top().swap( ca);
+ self->at_exit.pop();
+ ca();
+ }
+ this_fiber::cancel();
+}
+
+void
+fiber::init_()
+{
+ if ( ! info_) throw fiber_moved();
+
+ info_->uctx = ::CreateFiber(
+ info_->stack_size,
+ static_cast< LPFIBER_START_ROUTINE >( & trampoline),
+ static_cast< LPVOID >( info_.get() ) );
+}
+
+void
+fiber::switch_to_( fiber & to)
+{
+ if ( ! info_ || ! to.info_) throw fiber_moved();
+
+ ::SwitchToFiber( to.info_->uctx);
+}
+
+void
+fiber::convert_thread_to_fiber()
+{
+ if ( ! is_thread_a_fiber() )
+ if ( ::ConvertThreadToFiber( 0) == 0)
+ throw system::system_error(
+ system::error_code(
+ GetLastError(),
+ system::system_category) );
+}
+
+void
+fiber::convert_fiber_to_thread()
+{
+ if ( ! this_fiber::runs_as_fiber() && is_thread_a_fiber() )
+ if ( ::ConvertFiberToThread() == 0)
+ throw system::system_error(
+ system::error_code(
+ GetLastError(),
+ system::system_category) );
+}
+
+}}
+
+#include <boost/config/abi_suffix.hpp>

Added: sandbox/fiber/libs/fiber/src/detail/info_base_posix.cpp
==============================================================================
--- (empty file)
+++ sandbox/fiber/libs/fiber/src/detail/info_base_posix.cpp 2010-01-01 13:01:42 EST (Fri, 01 Jan 2010)
@@ -0,0 +1,54 @@
+
+// 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/detail/info_base_posix.hpp>
+
+#include <cerrno>
+
+#include <boost/assert.hpp>
+#include <boost/system/system_error.hpp>
+
+#include <boost/config/abi_prefix.hpp>
+
+namespace boost {
+namespace fibers {
+namespace detail {
+
+info_base::info_base() :
+ use_count( 0),
+ stack_size( 0),
+ priority( 0),
+ uctx(),
+ uctx_stack(),
+ state( STATE_MASTER),
+ interrupt( INTERRUPTION_DISABLED),
+ at_exit()
+{}
+
+info_base::info_base( std::size_t stack_size_) :
+ use_count( 0),
+ stack_size( stack_size_),
+ priority( 0),
+ uctx(),
+ uctx_stack( new char[stack_size]),
+ state( STATE_NOT_STARTED),
+ interrupt( INTERRUPTION_DISABLED)
+{
+ BOOST_ASSERT( uctx_stack);
+
+ if ( ::getcontext( & uctx) == -1)
+ throw system::system_error(
+ system::error_code(
+ errno,
+ system::system_category) );
+ uctx.uc_stack.ss_sp = uctx_stack.get();
+ uctx.uc_stack.ss_size = stack_size;
+ uctx.uc_link = 0;
+}
+
+}}}
+
+#include <boost/config/abi_suffix.hpp>

Added: sandbox/fiber/libs/fiber/src/detail/info_base_windows.cpp
==============================================================================
--- (empty file)
+++ sandbox/fiber/libs/fiber/src/detail/info_base_windows.cpp 2010-01-01 13:01:42 EST (Fri, 01 Jan 2010)
@@ -0,0 +1,52 @@
+
+// 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/detail/info_base_windows.hpp>
+
+#include <cerrno>
+
+#include <boost/assert.hpp>
+#include <boost/system/system_error.hpp>
+
+#include <boost/config/abi_prefix.hpp>
+
+namespace boost {
+namespace fibers {
+namespace detail {
+
+info_base::info_base() :
+ use_count( 0),
+ stack_size( 0),
+ priority( 0),
+ uctx(),
+ state( STATE_MASTER),
+ interrupt( INTERRUPTION_DISABLED),
+ at_exit(),
+ st( 0)
+{
+ uctx = ::GetCurrentFiber();
+ if ( ! uctx)
+ throw system::system_error(
+ system::error_code(
+ ::GetLastError(),
+ system::system_category) );
+}
+
+info_base::~info_base()
+{ if ( state != STATE_MASTER) ::DeleteFiber( uctx); }
+
+info_base::info_base( std::size_t stack_size_) :
+ use_count( 0),
+ stack_size( stack_size_),
+ priority( 0),
+ uctx(),
+ state( STATE_NOT_STARTED),
+ interrupt( INTERRUPTION_DISABLED)
+{}
+
+}}}
+
+#include <boost/config/abi_suffix.hpp>

Deleted: sandbox/fiber/libs/fiber/src/fiber_posix.cpp
==============================================================================
--- sandbox/fiber/libs/fiber/src/fiber_posix.cpp 2010-01-01 13:01:42 EST (Fri, 01 Jan 2010)
+++ (empty file)
@@ -1,82 +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/fiber.hpp>
-
-extern "C" {
-
-#include <ucontext.h>
-
-}
-
-#include <cerrno>
-
-#include <boost/system/system_error.hpp>
-
-#include <boost/fiber/exceptions.hpp>
-#include <boost/fiber/utility.hpp>
-
-#include <boost/config/abi_prefix.hpp>
-
-namespace boost {
-namespace fibers {
-
-void trampoline( detail::info_base * self)
-{
- BOOST_ASSERT( self);
- try
- { self->run(); }
- catch ( fiber_interrupted const&) {}
- catch (...) {}
- while ( ! self->at_exit.empty() )
- {
- detail::info_base::callable_t ca;
- self->at_exit.top().swap( ca);
- self->at_exit.pop();
- ca();
- }
- this_fiber::cancel();
-}
-
-void
-fiber::init_()
-{
- typedef void fn_type( detail::info_base *);
- typedef void ( * st_fn)();
- fn_type * fn_ptr( trampoline);
-
- if ( ! info_) throw fiber_moved();
-
- ::makecontext(
- & info_->uctx,
- ( st_fn)( fn_ptr),
- 1,
- info_.get() );
-}
-
-void
-fiber::switch_to_( fiber & to)
-{
- if ( ! info_ || ! to.info_) throw fiber_moved();
-
- if ( ::swapcontext( & info_->uctx, & to.info_->uctx) != 0)
- throw system::system_error(
- system::error_code(
- errno,
- system::system_category) );
-}
-
-void
-fiber::convert_thread_to_fiber()
-{}
-
-void
-fiber::convert_fiber_to_thread()
-{}
-
-}}
-
-#include <boost/config/abi_suffix.hpp>

Deleted: sandbox/fiber/libs/fiber/src/fiber_windows.cpp
==============================================================================
--- sandbox/fiber/libs/fiber/src/fiber_windows.cpp 2010-01-01 13:01:42 EST (Fri, 01 Jan 2010)
+++ (empty file)
@@ -1,103 +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/fiber.hpp>
-
-extern "C" {
-
-#include <windows.h>
-
-}
-
-#include <cerrno>
-
-#include <boost/system/system_error.hpp>
-
-#include <boost/fiber/exceptions.hpp>
-#include <boost/fiber/utility.hpp>
-
-#include <boost/config/abi_prefix.hpp>
-
-namespace {
-
-bool is_thread_a_fiber()
-{
-#if ( _WIN32_WINNT > 0x0600)
- return ::IsThreadAFiber() == TRUE;
-#else
- LPVOID current = ::GetCurrentFiber();
- return 0 != current && current != reinterpret_cast< LPVOID >( 0x1E00);
-#endif
-}
-
-}
-
-namespace boost {
-namespace fibers {
-
-VOID CALLBACK trampoline( LPVOID vp)
-{
- detail::info_base * self(
- static_cast< detail::info_base * >( vp) );
- BOOST_ASSERT( self);
- try
- { self->run(); }
- catch ( fiber_interrupted const&) {}
- catch (...) {}
- while ( ! self->at_exit.empty() )
- {
- detail::info_base::callable_t ca;
- self->at_exit.top().swap( ca);
- self->at_exit.pop();
- ca();
- }
- this_fiber::cancel();
-}
-
-void
-fiber::init_()
-{
- if ( ! info_) throw fiber_moved();
-
- info_->uctx = ::CreateFiber(
- info_->stack_size,
- static_cast< LPFIBER_START_ROUTINE >( & trampoline),
- static_cast< LPVOID >( info_.get() ) );
-}
-
-void
-fiber::switch_to_( fiber & to)
-{
- if ( ! info_ || ! to.info_) throw fiber_moved();
-
- ::SwitchToFiber( to.info_->uctx);
-}
-
-void
-fiber::convert_thread_to_fiber()
-{
- if ( ! is_thread_a_fiber() )
- if ( ::ConvertThreadToFiber( 0) == 0)
- throw system::system_error(
- system::error_code(
- GetLastError(),
- system::system_category) );
-}
-
-void
-fiber::convert_fiber_to_thread()
-{
- if ( ! this_fiber::runs_as_fiber() && is_thread_a_fiber() )
- if ( ::ConvertFiberToThread() == 0)
- throw system::system_error(
- system::error_code(
- GetLastError(),
- system::system_category) );
-}
-
-}}
-
-#include <boost/config/abi_suffix.hpp>

Deleted: sandbox/fiber/libs/fiber/src/info_base_posix.cpp
==============================================================================
--- sandbox/fiber/libs/fiber/src/info_base_posix.cpp 2010-01-01 13:01:42 EST (Fri, 01 Jan 2010)
+++ (empty file)
@@ -1,54 +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/detail/info_base_posix.hpp>
-
-#include <cerrno>
-
-#include <boost/assert.hpp>
-#include <boost/system/system_error.hpp>
-
-#include <boost/config/abi_prefix.hpp>
-
-namespace boost {
-namespace fibers {
-namespace detail {
-
-info_base::info_base() :
- use_count( 0),
- stack_size( 0),
- priority( 0),
- uctx(),
- uctx_stack(),
- state( STATE_MASTER),
- interrupt( INTERRUPTION_DISABLED),
- at_exit()
-{}
-
-info_base::info_base( std::size_t stack_size_) :
- use_count( 0),
- stack_size( stack_size_),
- priority( 0),
- uctx(),
- uctx_stack( new char[stack_size]),
- state( STATE_NOT_STARTED),
- interrupt( INTERRUPTION_DISABLED)
-{
- BOOST_ASSERT( uctx_stack);
-
- if ( ::getcontext( & uctx) == -1)
- throw system::system_error(
- system::error_code(
- errno,
- system::system_category) );
- uctx.uc_stack.ss_sp = uctx_stack.get();
- uctx.uc_stack.ss_size = stack_size;
- uctx.uc_link = 0;
-}
-
-}}}
-
-#include <boost/config/abi_suffix.hpp>

Deleted: sandbox/fiber/libs/fiber/src/info_base_windows.cpp
==============================================================================
--- sandbox/fiber/libs/fiber/src/info_base_windows.cpp 2010-01-01 13:01:42 EST (Fri, 01 Jan 2010)
+++ (empty file)
@@ -1,52 +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/detail/info_base_windows.hpp>
-
-#include <cerrno>
-
-#include <boost/assert.hpp>
-#include <boost/system/system_error.hpp>
-
-#include <boost/config/abi_prefix.hpp>
-
-namespace boost {
-namespace fibers {
-namespace detail {
-
-info_base::info_base() :
- use_count( 0),
- stack_size( 0),
- priority( 0),
- uctx(),
- state( STATE_MASTER),
- interrupt( INTERRUPTION_DISABLED),
- at_exit(),
- st( 0)
-{
- uctx = ::GetCurrentFiber();
- if ( ! uctx)
- throw system::system_error(
- system::error_code(
- ::GetLastError(),
- system::system_category) );
-}
-
-info_base::~info_base()
-{ if ( state != STATE_MASTER) ::DeleteFiber( uctx); }
-
-info_base::info_base( std::size_t stack_size_) :
- use_count( 0),
- stack_size( stack_size_),
- priority( 0),
- uctx(),
- state( STATE_NOT_STARTED),
- interrupt( INTERRUPTION_DISABLED)
-{}
-
-}}}
-
-#include <boost/config/abi_suffix.hpp>


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