- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
如下所示,我在 Linux (RHEL) 上运行 Python 2.6,但出于某种原因它没有 os.O_EXLOCK。有什么原因吗?有办法解决这个问题吗?
Python 2.6.5 (r265:79063, Apr 9 2010, 11:16:46)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-48)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.O_EXLOCK
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'O_EXLOCK'
>>> os.O_DSYNC
4096
>>>
最佳答案
如 the Python Standard Library documentation 中所述,
The following constants are options for the flags parameter to the open() function. They can be combined using the bitwise OR operator |. Some of them are not available on all platforms. For descriptions of their availability and use, consult the open(2) manual page on Unix or the MSDN on Windows.
O_EXLOCK
originated in the BSD world ;它通常在 Linux 上不可用。您也许可以使用 Python fcntl
module相反。
关于python - os.O_EXLOCK(独占锁)在 Linux 上的 Python 中不存在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12083536/
使用 O_EXLOCK 标志调用 open() 与仅调用 open() 然后调用 有什么区别羊群()?后者具有潜在的竞争条件,但除此之外,两种方式都获得了对文件的独占进程锁,对吗? 最佳答案 唯一的区
如下所示,我在 Linux (RHEL) 上运行 Python 2.6,但出于某种原因它没有 os.O_EXLOCK。有什么原因吗?有办法解决这个问题吗? Python 2.6.5 (r265:790
我是一名优秀的程序员,十分优秀!