Mutex
In computer science, a lock or mutex (from mutual exclusion) is a synchronization primitive: a mechanism that enforces limits on access to a resource when there are many threads of execution. A lock is designed to implement a mutual exclusion concurrency control policy, and with various possible methods, multiple unique implementations exist for different applications. Lock (computer science)
m.lock();
// some critical operation
// uninterrupted
m.unlock();