add file lock function.