Lockcontrol ~onerror lname wait f opens file lname, puts a write lock on it and then calls f. If wait is true then if it tries to access locked file it will be blocked until these lock is removed. Otherwise it will fail, and function onerror will be called. If flag no_lock_flag is set then returns f () immediatly.