CPP Mutex

#include <mutex>
#include <vector>
std::mutex door;    // mutex declaration
std::vector<int> v; // shared data
door.lock();
/*-----------------------*/
/* This is a thread-safe zone: just one thread at the time allowed
 * 
 * Unique ownership of vector v guaranteed 
 */
/*-----------------------*/
door.unlock();
Suman Majhi