36
Mutex poisoning is not for everyone
(bertptrs.nl)
Welcome to the Rust community! This is a place to discuss about the Rust programming language.
Credits
I was talking about what a codebase would want a non-Result-returning
lock()to look like (the panic message, or forcing abort, extra logging, signal handling...etc).Poisoning (as a negative) is only relevant if we are pretending it matters for performance. And you already conceded that this is not a part of the conversation as far as you're concerned.
The "rarely relevant" (as in playing any operative role at all) is also pure conjecture, or if we want to be nicer, it's totally contextual and use-case dependant.
lock_apiprovides a generic interface so you can e.g. seamlessly swipe out primitives fromparking_lotwith primitives fromspin, you know, the whole point behind generic programming!This is in no way comparable with
leftpad. And I wasn't actually pointing to it as a solution (to the largely non-existing problem). I just wanted to point out that extension traits for synchronisation primitives already exist with wide usage in the ecosystem, since you seemed to not be aware.If you have an aversion to extension traits. Here is a trivial unit struct wrapper solution. You don't even need to change the
Mutextype name or thelock()method name in your code.What is the notable relevant problem. Can you state it plainly?
I already told you, convenience, developer experience. Ergonomics basically. None of this is fixed by some code snippet, whether it's an extension trait or wrapper type. That just makes things worse. This has nothing to do with performance, as I already said.
Can you point the notable relevant inconvenience, bad developer experience, and poor ergonomics developers are suffering from?
Is it all caused by a
lock()method returning aResult?Anything else?
Yes? I think I am done with this conversation. If you don't think this is a problem, we just disagree. Just move on, you don't have to convince everyone else who's been discussing this problem for years that it isn't a problem.
I haven't seen anyone else concede the performance talking point (under different banners), but proceeding to make this out to be a big issue. This includes this thread's OP which literally starts on-topic arguments with:
This is what makes your positioning weird.
My replies here, starting with pointing out the lack of benchmarks of real-world use-cases, come from actually bothering to read OP, IN FULL.