mutex
A mutex (short for "mutual exclusion") is a synchronization primitive used in computer programming to manage access to shared resources. It ensures that only one thread or process can access a resource at a time, preventing conflicts and data corruption. When a thread locks a mutex, other threads must wait until it is unlocked before they can proceed.
Mutexes are commonly used in multi-threaded applications, where multiple threads may attempt to read or write to the same data simultaneously. By using a mutex, developers can maintain data integrity and ensure that operations on shared resources are performed safely and efficiently.