Boost logo

Boost :

Subject: Re: [boost] Boost.Fiber review January 6-15
From: Oliver Kowalke (oliver.kowalke_at_[hidden])
Date: 2014-01-07 13:41:34


2014/1/7 Antony Polukhin <antoshkka_at_[hidden]>

> Thanks, already trying them.
> What will happen on fiber::mutex.lock() call if all the fibers on current
> thread are suspended? Will the mutex call `this_thread::yield()`?
>

yes.
btw, you could take a look at unit-test test_mutex_mt.cpp

> Another implementation question:
> Why there are so many atomics in fiber_base? Looks like fiber is usually
> used in a single thread, and in situations when fiber is moved from one
> thread to another memory barrier would be sufficient.
>

yes, synchronization is done via atomics.
In a single threaded env the lib wouldn't require atomics because all fibers
running in on thread.
A multithread env requires an memory barrier - boost.fiber uses a spinlock
which
yields a fiber if already locked.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk