What Is a Mutex Lock and How Is It an Alternative Reentrancy Prevention Mechanism?
A mutex (mutual exclusion) lock is a mechanism that prevents a function from being called again while it is already executing. In Solidity, this is typically implemented using a state variable (a boolean or an integer) that acts as a lock.
The function sets the lock at the beginning (Check), performs its logic and external call (Interaction), and then releases the lock at the end (Effect). The function checks the lock status at the start, reverting if it's already locked.