Atomics in C++11

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Atomics in C++11

Nicholas Krause
Greetings,

I was wondering if its possible to use the C11 atomics library for
multithreading

GCC. Not sure if its a good idea due to concerns about older plaforms
not having

a C11 supported libraries or compiler.

If not then the best way is pthreads key support and other posix thread
supports.

Thanks,

Nick

Reply | Threaded
Open this post in threaded view
|

Re: Atomics in C++11

Jason Merrill
On Fri, Sep 20, 2019 at 8:32 AM Nicholas Krause <[hidden email]> wrote:
> I was wondering if its possible to use the C11 atomics library for
> multithreading
>
> GCC. Not sure if its a good idea due to concerns about older plaforms
> not having a C11 supported libraries or compiler.

I've been wondering if it's time to move to C++11 in general, since
we've had compilers with C++11 support for more than 5 years at this
point.

Jason

Reply | Threaded
Open this post in threaded view
|

Re: Atomics in C++11

Nicholas Krause

On 9/20/19 4:09 PM, Jason Merrill wrote:

> On Fri, Sep 20, 2019 at 8:32 AM Nicholas Krause <[hidden email]> wrote:
>> I was wondering if its possible to use the C11 atomics library for
>> multithreading
>>
>> GCC. Not sure if its a good idea due to concerns about older plaforms
>> not having a C11 supported libraries or compiler.
> I've been wondering if it's time to move to C++11 in general, since
> we've had compilers with C++11 support for more than 5 years at this
> point.
>
> Jason
>
Jason,

It's up to the community at large but both me and the other student who
is CCed

on this work would find it useful. He wants to use TLS for certain
structures and

functions to be doubled per thread for no locking e.t.c. and ease of
programming.


He can add his comments if need be,

Nick

Reply | Threaded
Open this post in threaded view
|

Re: Atomics in C++11

Joel Sherrill <joel.sherrill@OARcorp.com>-6
On Fri, Sep 20, 2019, 3:12 PM Nicholas Krause <[hidden email]> wrote:

>
> On 9/20/19 4:09 PM, Jason Merrill wrote:
> > On Fri, Sep 20, 2019 at 8:32 AM Nicholas Krause <[hidden email]>
> wrote:
> >> I was wondering if its possible to use the C11 atomics library for
> >> multithreading
> >>
> >> GCC. Not sure if its a good idea due to concerns about older plaforms
> >> not having a C11 supported libraries or compiler.
> > I've been wondering if it's time to move to C++11 in general, since
> > we've had compilers with C++11 support for more than 5 years at this
> > point.
> >
> > Jason
> >
> Jason,
>
> It's up to the community at large but both me and the other student who
> is CCed
>
> on this work would find it useful. He wants to use TLS for certain
> structures and
>
> functions to be doubled per thread for no locking e.t.c. and ease of
> programming.
>

When I reviewed TLS support for all RTEMS targets, it wasn't clear that TLS
ABI is defined for all supported GCC architectures or that it was
universally supported by the backends.

I'm not questioning the value of TLS. I'm just wanting to make sure all GCC
targets actually support TLS.

I may have missed a default generic implementation. It is really hard to
find ABI info for all pro processors.

I would be thrilled to learn I missed the default generic implementation.
This would make supporting it across the 18 architectures RTEMS supports
much easier. :)

>
>
> He can add his comments if need be,
>
> Nick
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Atomics in C++11

Nicholas Krause

On 9/20/19 4:43 PM, Joel Sherrill wrote:

> On Fri, Sep 20, 2019, 3:12 PM Nicholas Krause <[hidden email]> wrote:
>
>> On 9/20/19 4:09 PM, Jason Merrill wrote:
>>> On Fri, Sep 20, 2019 at 8:32 AM Nicholas Krause <[hidden email]>
>> wrote:
>>>> I was wondering if its possible to use the C11 atomics library for
>>>> multithreading
>>>>
>>>> GCC. Not sure if its a good idea due to concerns about older plaforms
>>>> not having a C11 supported libraries or compiler.
>>> I've been wondering if it's time to move to C++11 in general, since
>>> we've had compilers with C++11 support for more than 5 years at this
>>> point.
>>>
>>> Jason
>>>
>> Jason,
>>
>> It's up to the community at large but both me and the other student who
>> is CCed
>>
>> on this work would find it useful. He wants to use TLS for certain
>> structures and
>>
>> functions to be doubled per thread for no locking e.t.c. and ease of
>> programming.
>>
> When I reviewed TLS support for all RTEMS targets, it wasn't clear that TLS
> ABI is defined for all supported GCC architectures or that it was
> universally supported by the backends.
>
> I'm not questioning the value of TLS. I'm just wanting to make sure all GCC
> targets actually support TLS.
>
> I may have missed a default generic implementation. It is really hard to
> find ABI info for all pro processors.
>
> I would be thrilled to learn I missed the default generic implementation.
> This would make supporting it across the 18 architectures RTEMS supports
> much easier. :)

Seems its using IA-64 ABI as reported in a  older manual here:

https://gcc.gnu.org/onlinedocs/gcc-3.3/gcc/Thread-Local.html

Nick

>>
>> He can add his comments if need be,
>>
>> Nick
>>
>>