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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user