.. _UpgradeDowngrade: Upgrade/Downgrade ================= It is possible to upgrade a reader lock to a writer lock, by using the method ``upgrade_to_writer``. Here is an example. :: std::vector MyVector; typedef spin_rw_mutex MyVectorMutexType; MyVectorMutexType MyVectorMutex;   void AddKeyIfMissing( const string& key ) { // Obtain a reader lock on MyVectorMutex MyVectorMutexType::scoped_lock lock(MyVectorMutex,/*is_writer=*/false); size_t n = MyVector.size(); for( size_t i=0; i