文件锁的问题

Locks are associated with processes.(文件锁跟进程相关联的.) A process can only have one kind of lock set for each byte of a given file. When any file descriptor for that file(同一进程打开同一份文件多次时,进程会得到不同的fd) is closed by the process, all of the locks that process holds on that file are released, even if the locks were made using other descriptors that remain open. (如果此时用其中一个fd对文件进行加锁,当进程利用fd来close文件,不管是加锁使用过的fd,还是其他fd,都会造成进程加的文件锁被释放掉,尽管此时可能加锁使用的fd还没close文件.但是只要是同一进程,该文件被关了,锁就会被释放.) Likewise, locks are released when a process exits, and are not inherited by child processes created using fork.(这个就跟第一句呼应,毕竟跟进程相关,子进程就算是fork出来了,子进程不是父进程)

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值