on windows flyweight simple_locking is using std::mutex but it should be using std::recursive_mutex()
Dear All, On windows flyweight simple_locking is using std::mutex but it should be using std::recursive_mutex. I've got this firing an exception due to _Check_C_return() getting passed something else than success (number 3). 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. The secured set.erase() can cause further flyweights to be destroyed given a suitable recursive use of flyweight. Kind Regards Peter Foelsche PS. Thanks for boost!
On Jun 29, 2023, at 11:17 AM, Foelsche, Peter via Boost
Dear All,
On windows flyweight simple_locking is using std::mutex but it should be using std::recursive_mutex.
I've got this firing an exception due to _Check_C_return() getting passed something else than success (number 3).
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. The secured set.erase() can cause further flyweights to be destroyed given a suitable recursive use of flyweight.
Kind Regards Peter Foelsche
PS. Thanks for boost!
Opened https://github.com/boostorg/flyweight/issues/12 for this issue. — Marshall
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.
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
Are you referring to https://github.com/boostorg/flyweight/blob/develop/include/boost/flyweight/s... 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. 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
El 30/06/2023 a las 9:00, Alexander Grund via Boost escribió:
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/s...
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.
Hi, this is indeed a regression in Boost.Flyweight, please see https://github.com/boostorg/flyweight/issues/12 for details. Should be fixed now. Best, Joaquín M López Muñoz
participants (4)
-
Alexander Grund
-
Foelsche, Peter
-
Joaquin M López Muñoz
-
Marshall Clow