<human>:  I have a question about thread synchronization. When should I use a mutex?
<bot>: A mutex is a synchronization mechanism that allows only one thread to access a resource at a time. It is used to protect shared data from being accessed by multiple threads at the same time. It is often used to protect critical sections of code from being executed by multiple threads at the same time.