Boost logo

Boost :

From: Gavin Lambert (boost_at_[hidden])
Date: 2023-06-02 00:24:46


On 2/06/2023 11:43, Peter Dimov wrote:
> Gavin Lambert wrote:
>> FWIW though, atomic_* on shared_ptr is entirely banned in my codebase
>> precisely because of its spinlock implementation.
>
> Which part is wrong?

Caused massive performance issues in my codebase. Not really a fault of
your implementation per se (other than it's a spinlock at all), just a
consequence of priority inversion plus too many collisions in the
spinlock pool. Probably not something that would be a problem for most
apps; I just have some special quirks.

It's not only spinlocks (though they're worse than regular locks); any
locks at all have to justify themselves pretty hard (I use a lot of
lock-free techniques and structures, and non-blocking "locks" like
strands and workqueues).

I have a custom lock that behaves better in my environment, so it's nice
when things that do require a lock either leave the app to handle that
externally or allow it to be configured via template.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk