[vlc-devel] [PATCH] Make mutexes mutable
Rémi Denis-Courmont
remi at remlab.net
Tue Jan 9 12:41:37 CET 2018
On lundi 8 janvier 2018 21:45:16 EET Romain Vimont wrote:
> Mutexes must be locked and unlocked even in C++ const methods. To avoid
> const casts, simply declare them mutable.
If you need to lock, then your method is not const. Conversely, if the object
is guaranteed to be identical before and after the method call, then the
methiod does not need to lock any mutex.
I don't agree with your line of reasoning, and it seems that the C, POSIX and
C++ don't either - otherwise they'd have lock and unlock as immutable methods
too.
--
Rémi Denis-Courmont
More information about the vlc-devel
mailing list