In the classic problem of transferring money from one bank account to another, the accepted solution (I believe) is to associate a mutex with each bank account, then lock both b
Your problem is to associate the locking with the data. In my eyes, stuffing the mutex into the object is fine. You could go even further, making the objects essentially into monitors: Lock to enter a function member, unlock when leaving.