- 论坛徽章:
- 0
|
查看了一下fcntl的manpage,在BUGS下面有如下一段:
The implementation of mandatory locking in all known versions of Linux is subject to race conditions which render it unreliable: a write(2) call
that overlaps with a lock may modify data after the mandatory lock is acquired; a read(2) call that overlaps with a lock may detect changes to
data that were made only after a write lock was acquired. Similar races exist between mandatory locks and mmap(2). It is therefore inadvisable
to rely on mandatory locking.
就是说强制锁不可靠,那么有什么替代方案,让别的进程不能读写某个我正在操作的文件吗?
谢谢 |
|