add lock mechanism for file operations. add comments.

refs #1
Merge branch 'master' of https://github.com/moriya16g/naegi