Make lock/unlock function static