Monday, September 20, 2021

Digest for comp.lang.c++@googlegroups.com - 25 updates in 5 topics

Bonita Montero <Bonita.Montero@gmail.com>: Sep 20 07:03AM +0200

Am 20.09.2021 um 00:29 schrieb Chris M. Thomasson:
 
>     return 0;
> }
> _________________________
 
That's not what I wanted to test.
Read this thread:
 
https://stackoverflow.com/questions/69245183/dcas-alternative-with-no-help-of-the-kernel
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>: Sep 19 10:19PM -0700

On 9/19/2021 10:03 PM, Bonita Montero wrote:
 
> That's not what I wanted to test.
> Read this thread:
 
> https://stackoverflow.com/questions/69245183/dcas-alternative-with-no-help-of-the-kernel
 
A quote:
 
"I just wanted to test if my compiler recognizes ...and uses DCASes on
it or if it supplements the pair with a usual lock"
 
Well, is_lock_free() should help?
Bonita Montero <Bonita.Montero@gmail.com>: Sep 20 07:26AM +0200

Am 20.09.2021 um 07:19 schrieb Chris M. Thomasson:
 
> "I just wanted to test if my compiler recognizes ...and uses DCASes on
> it or if it supplements the pair with a usual lock"
 
> Well, is_lock_free() should help?
 
I put the compare_exchangE_weak-code into a noinline function:
 
struct uip_pair
{
uip_pair() = default;
uip_pair( uintptr_t first, uintptr_t second ) :
first( first ),
second( second )
{
}
uintptr_t first, second;
};
 
using atomic_pair = atomic<uip_pair>;
 
#if defined(_MSC_VER)
#define NOINLINE __declspec(noinline)
#elif defined(__GNUC__) || defined(__clang__)
#define NOINLINE __attribute((noinline))

No comments: