On 25/02/20 09:52 +0100, Sebastian Huber wrote:
Hello Thomas,
some operating systems provide already an implementation of binary
semaphores with a compatible API, e.g. RTEMS. It would be nice if I
could use it in libstdc++. I guess you don't want to have #ifdef
__rtems__ stuff in this code. What about defining a binary semaphore
API for gthr.h and then implement the optional futex support in
libgcc/gthr-posix.h?
gthr.h is supposed to be an abstraction of pthreads, not futexes. I
also don't see why more libstdc++ code should live in libgcc than
necessary.
It would be OK to add semaphore support to gthr-*.h and then have
libstdc++ either use futexes (where available) or the gthr code.