更新时间:2023-11-25 16:21:10
POSIX不提供任何方式来做到这一点。因此,考虑到当前的可用便携式O / S接口,没有便携式解决方案。
您必须制定一些更高级别的方法,为开放位提供单一访问点。这就像锁文件。
Given the name of a file, how can I determine if the file is currently opened or in-use? (I am talking about files rather than Perl file handles.)
Please note that I am looking for a general-purpose Perl solution rather than an operating system-specific one. At a minimum, I would like something that works both on Windows and GNU/Linux-based systems.
POSIX does not provide any way to do this. Therefore, no portable solution is possible given the current portable O/S interface available.
You’d have to craft some higher level approach that provides a single point of access for the opening bits. It’s like with lock files.