1. Use the flock in the shell script,
http://linux.die.net/man/1/flock
2. Use flock in code
http://linux.die.net/man/2/flock
My sample.
使用flock实现文件锁
本文介绍了如何在Linux环境中使用flock系统调用实现文件级别的锁定。通过示例代码展示了打开文件、获取独占锁、执行受保护的操作、解锁及关闭文件的过程。
1. Use the flock in the shell script,
http://linux.die.net/man/1/flock
2. Use flock in code
http://linux.die.net/man/2/flock
My sample.

被折叠的 条评论
为什么被折叠?