◆ Purpose

to save the re-entrancy attack, to save the double-spending

◆ Input & Return value

none

◆ Example

If you execute the locked function two times, you can’t execute second one.

◆ Code and Explain

modifier lock() {
        require(unlocked == 1, 'UniswapV2: LOCKED');
        unlocked = 0;
        _; //execution locked function's codes
        unlocked = 1;
    }

◆ Resources

https://github.com/Uniswap/v2-core/blob/master/contracts/UniswapV2Pair.sol#L31

https://www.youtube.com/watch?v=76So4jCysAQ