After watching Herb Sutter\'s talk You Don\'t Know const and mutable, I wonder whether I should always define a mutex as mutable? If yes, I guess the same holds for any sync
Let's talk about the change in const.
void somefunc(Foo&);
void somefunc(const Foo&);
In C++03 and before, the const version, compared to the non-const one, provides additional guarantees to the callers. It promises not to modify its argument, where by modification we mean calling Foo's non-const member functions (including assignment etc), or passing it to functions that expect a non-const argument, or doing same to its exposed non-mutable data members. somefunc restricts itself to const operations on Foo. And the additional guarantee is totally one-sided. Neither the caller nor the Foo provider do not have to do anything special in order to call the const version. Anyone who is able to call the non-const version can call the const version too.
In C++11 this changes. The const version still provides the same guarantee to the caller, but now it comes with a price. The provider of Foo must make sure that all const operations are thread safe. Or it least it must do so when somefunc is a standard library function. Why? Because the standard library may parallelize its operations, and it will call const operations on anything and everything without any additional synchronization. So you, the user, must make sure this additional synchronization is not needed. Of course this is not a problem in most cases, as most classes have no mutable members and most const operations don't touch global data.
So what mutable means now? It's the same as before! Namely, this data is non-const, but it is an implementation detail, I promise it does not affect the observable behavior. This means that no, you don't have to mark everything in sight mutable, just as you didn't do it in C++98. So when you should mark a data member mutable? Just like in C++98, when you need to call its non-const operations from a const method, and you can guarantee it won't break anything. To reiterate:
mutable.The first condition is imposed, like in C++98, because other code, including the standard library, may call your const methods and nobody should observe any changes resulting from such calls. The second condition is there, and this is what's new in C++11, because such calls can be made asynchronously.