[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

g++/armel: std::future and std::exception_ptr are missing



Hello,

Answering to myself after digging through libstdc++ includes and
sources:

2013-11-16 15:05, Eugene V. Lyubimkin:
> For some reason, on armel architecture exclusively [1], g++ has problems
> compiling seemingly any program which uses std::future [2].

std::future is actually defined in libstdc++'s headers only if:

"#if defined(_GLIBCXX_HAS_GTHREADS) &&
defined(_GLIBCXX_USE_C99_STDINT_TR1) && (ATOMIC_INT_LOCK_FREE > 1)"

On armel porterbox, ATOMIC_INT_LOCK_FREE == 1, which according to the
libstdc++ documentation means that, unlike every other Debian
architecture, operations on atomic ints are not guaranteed to be
lock-free there.

I don't know is this a shortcoming in libstdc++
configuration/implementation or armel doesn't provide atomic
incrementing/decrementing facilities.

As for atomics, std::future itself only uses std::atomic_flag, which is
guaranteed to lock-free by C++ standard. But another type it uses,
std::exception_ptr, requires atomic ints, namely, it uses a typedef
_Atomic_word for reference counting (incrementing and decrementing using
the acquire/release memory model).

Either way, right now any C++11 program linked to libstdc++ which uses
<future> facilities or transfer exceptions will fail to compile on
armel. On armhf there is no such a problem.

-- 
Eugene V. Lyubimkin aka JackYF, JID: jackyf.devel(maildog)gmail.com
C++ GNU/Linux userspace developer, Debian Developer


Reply to: