diff -ru trunk/locks.py work/locks.py
|
old
|
new
|
|
| 53 | 53 | hfile = win32file._get_osfhandle(fd(file)) |
| 54 | 54 | win32file.UnlockFileEx(hfile, 0, -0x10000, __overlapped) |
| 55 | 55 | elif system_type == 'posix': |
| | 56 | def lockf(fd, operation): |
| | 57 | try: |
| | 58 | fcntl.lockf(fd, operation) |
| | 59 | except IOError, e: |
| | 60 | if e.errno == 45: # Operation not supported |
| | 61 | pass |
| | 62 | else: |
| | 63 | raise |
| | 64 | |
| 56 | 65 | def lock(file, flags): |
| 57 | | fcntl.lockf(fd(file), flags) |
| | 66 | lockf(fd(file), flags) |
| 58 | 67 | |
| 59 | 68 | def unlock(file): |
| 60 | | fcntl.lockf(fd(file), fcntl.LOCK_UN) |
| | 69 | lockf(fd(file), fcntl.LOCK_UN) |
| 61 | 70 | else: |
| 62 | 71 | # File locking is not supported. |
| 63 | 72 | LOCK_EX = LOCK_SH = LOCK_NB = None |