Date: Wed, 22 May 2024 14:13:20 +0000
> I think you drilled too much into the "mutex" and "locked" aspects, rather than thinking of the immovable and post initialization.
But it std::mutex is immovable for a reason ,and there’s only 1 way to initialize it. And the way it works defeats the purpose of this discussion.
> I mistakenly cut part of my response. The "getMutexTheOtherTeamToldMeToUse()" could be an application wide function that your project needs to use for logging/tracking.
> With that, you cannot forget to call the post-initialization. It's done for you.
But as I have explained there cannot be a “getMutexTheOtherTeamToldMeToUse()” because it is a std::mutex and it must be initialized at the address provided by the caller.
> There are even other types that *are* movable but moving is not cheap.
And I understand that. But as I have said std::mutex is not a good example.
Give me a better example and then I will tell you if it makes sense or not, and then let’s see if the reasons you want for doing this makes sense. For std::mutex it does not!
But it std::mutex is immovable for a reason ,and there’s only 1 way to initialize it. And the way it works defeats the purpose of this discussion.
> I mistakenly cut part of my response. The "getMutexTheOtherTeamToldMeToUse()" could be an application wide function that your project needs to use for logging/tracking.
> With that, you cannot forget to call the post-initialization. It's done for you.
But as I have explained there cannot be a “getMutexTheOtherTeamToldMeToUse()” because it is a std::mutex and it must be initialized at the address provided by the caller.
> There are even other types that *are* movable but moving is not cheap.
And I understand that. But as I have said std::mutex is not a good example.
Give me a better example and then I will tell you if it makes sense or not, and then let’s see if the reasons you want for doing this makes sense. For std::mutex it does not!
Received on 2024-05-22 14:13:25