2
0
mirror of https://github.com/boostorg/fiber.git synced 2026-02-19 14:22:23 +00:00

remove dependency to boost.thread

- use __thread/__declspec(thread) for static thread-local
  pointer to scheduler
This commit is contained in:
Oliver Kowalke
2012-11-24 10:56:05 +01:00
parent 799fe9b889
commit 3fe885d035
4 changed files with 8 additions and 7 deletions

View File

@@ -76,7 +76,6 @@ private:
> wqueue_t;
typedef wqueue_t::index< f_tag_t >::type f_idx_t;
typedef wqueue_t::index< tp_tag_t >::type tp_idx_t;
typedef std::deque< fiber_base::ptr_t > rqueue_t;
fiber_base::ptr_t active_fiber_;

View File

@@ -13,7 +13,6 @@ project boost/fiber
: requirements
<library>/boost/chrono//boost_chrono
<library>/boost/context//boost_context
<library>/boost/thread//boost_thread
<link>static
<threading>multi
: source-location ../src

View File

@@ -12,7 +12,6 @@ project boost/fiber/example
<library>../build//boost_fibers
<library>/boost/context//boost_context
<library>/boost/system//boost_system
<library>/boost/thread//boost_thread
<link>static
<threading>multi
;

View File

@@ -13,7 +13,6 @@
#include <boost/assert.hpp>
#include <boost/bind.hpp>
#include <boost/foreach.hpp>
#include <boost/thread/tss.hpp>
#include <boost/fiber/exceptions.hpp>
@@ -46,9 +45,14 @@ scheduler::~scheduler()
scheduler &
scheduler::instance()
{
static thread_specific_ptr< scheduler > static_local;
if ( ! static_local.get() ) static_local.reset( new scheduler() );
return * static_local.get();
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__DMC__) || \
(defined(__ICC) && defined(BOOST_WINDOWS))
static __declspec(thread) scheduler * static_local = 0;
#else
static __thread scheduler * static_local = 0;
#endif
if ( ! static_local) static_local = new scheduler();
return * static_local;
}
void