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

enable/disable atomic<> with BOOST_FIBERS_THREADSAFE

This commit is contained in:
Oliver Kowalke
2015-06-16 18:49:28 +02:00
parent 61dc492f31
commit 2002dba9d3
19 changed files with 284 additions and 23 deletions

View File

@@ -35,9 +35,13 @@ fiber_context::release() {
std::vector< fiber_context * > waiting;
// get all waiting fibers
#if defined(BOOST_FIBERS_THREADSAFE)
splk_.lock();
waiting.swap( waiting_);
splk_.unlock();
#else
waiting.swap( waiting_);
#endif
// notify all waiting fibers
for ( fiber_context * f : waiting) {
@@ -57,7 +61,9 @@ bool
fiber_context::join( fiber_context * f) {
BOOST_ASSERT( nullptr != f);
#if defined(BOOST_FIBERS_THREADSAFE)
std::unique_lock< detail::spinlock > lk( splk_);
#endif
if ( is_terminated() ) {
return false;
}