Boost logo

Boost :

From: Alexander Grund (alexander.grund_at_[hidden])
Date: 2023-06-30 07:00:22


Am 29.06.23 um 20:17 schrieb Foelsche, Peter via Boost:
> On windows flyweight simple_locking is using std::mutex but it should be using std::recursive_mutex.

Are you referring to
https://github.com/boostorg/flyweight/blob/develop/include/boost/flyweight/simple_locking.hpp?

I was confused that this Boost lib would be using the std-variants of
the locking classes not the Boost ones so I checked it.
And indeed I can't see any reference to `std::mutex`. Instead
`simple_locking` uses `recursive_lightweight_mutex` a custom mutex that
IS recursive.

> I've checked by implementing my own locking policy and it definitely shows that the code is attempting to hold more than a single lock in parallel on the same mutex.
Does this mean you don't use `simple_locking` but a custom locking
policy which uses `std::mutex`?

Then I'd say this is a mistake on your side.

I also double-checked the documentation which states

> The type |Locking::mutex_type| (or |Locking'::mutex_type| if (b)
applies) is a model of |Mutex| and supports recursive locking.

So change the `std::mutex` in your custom locking policy to use
`std::recursive_mutex`, or clarify if I misinterpreted anything.

Hope that helps

Alex




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