2
0
mirror of https://github.com/boostorg/fiber.git synced 2026-02-13 12:22:36 +00:00

enable atomics with BOOST_FIBERS_USE_ATOMCIS

This commit is contained in:
Oliver Kowalke
2015-06-19 21:39:34 +02:00
parent 2002dba9d3
commit 20d08d98cd
35 changed files with 1165 additions and 564 deletions

View File

@@ -16,7 +16,7 @@ namespace boost {
namespace fibers {
condition::condition() :
#if defined(BOOST_FIBERS_THREADSAFE)
#if defined(BOOST_FIBERS_USE_ATOMICS)
splk_(),
#endif
waiting_() {
@@ -30,7 +30,7 @@ void
condition::notify_one() {
fiber_context * f( nullptr);
#if defined(BOOST_FIBERS_THREADSAFE)
#if defined(BOOST_FIBERS_USE_ATOMICS)
std::unique_lock< detail::spinlock > lk( splk_);
// get one waiting fiber
if ( ! waiting_.empty() ) {
@@ -56,7 +56,7 @@ void
condition::notify_all() {
std::deque< fiber_context * > waiting;
#if defined(BOOST_FIBERS_THREADSAFE)
#if defined(BOOST_FIBERS_USE_ATOMICS)
std::unique_lock< detail::spinlock > lk( splk_);
// get all waiting fibers
waiting.swap( waiting_);