I have objects that can be opened in different modes, among which read and write.
If you opened it read you can still call

```
object->upgradeOpen();

```

It is common practice in our code to call

```
object->downgradeOpen();

```

When you are done writing.  

I usually find it easier to use the concept of a mutex that I learned in c++ essentials where you let this upgradeOpen and downgradeOpen be done in the constructor and destructor of this mutex object.

```
class ObjectMutex{
public:
    ObjectMutex(const Object& o)
      : m_o(o)
    {
        m_o.upgradeOpen();
    }

    ~ObjectMutex(){
        m_o.downgradeOpen();
    }
private:
    Object m_o;
};

```

Only problem is, it doesn't really lock the object to make it thread safe, so I don't think it really is a mutex.
Is there another accepted name to call this construction?