lock I<THING>
This function places an advisory lock on a variable, subroutine, or referenced object contained in THING until the lock goes out of scope. This is a built-in function only if your version of Perl was built with threading enabled, and if you've said use Threads
. Otherwise a user-defined function by this name will be called. See Thread.