[PATCH] Add c++2a binary_semaphore

Sebastian Huber sebastian.huber@embedded-brains.de
Fri Feb 21 12:33:00 GMT 2020


On 18/02/2020 15:30, Jonathan Wakely wrote:
> On 18/02/20 14:48 +0100, Sebastian Huber wrote:
>> Hello,
>>
>> On 18/02/2020 07:46, Thomas Rodgers wrote:
>>> This patch adds the c++2a semaphore header and binary_semaphore type. 
>>> The implementation is not complete, this patch is just to solicit 
>>> initial feedback.
>>
>> how do you plan to implement the binary semaphores? For example, do 
>> you want to add the binary semaphores to gthr.h or via a mutex and a 
>> condition variable or via some futex stuff? I ask because I would like 
>> to support this in RTEMS.
> 
> Futexes where possible.

It would be nice if this could be done through an extension of the 
gthr.h API similar to the condition variables (__GTHREAD_HAS_COND).

> Using POSIX semaphores might be a good alternative for the
> std::counting_semaphore type, 

Yes.

> but for std::binary_semaphore we talked
> about just using a spinlock based on std::atomic.

I would like to use the binary semaphores for task/interrupt 
synchronization. For this a blocking solution is required.

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber@embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.



More information about the Libstdc++ mailing list