| 139 | """ |
| 140 | |
| 141 | def __init__(self, lock_file, timeout = -1): |
| 142 | """ |
| 143 | """ |
| 144 | # The path to the lock file. |
| 145 | self._lock_file = lock_file |
| 146 | |
| 147 | # The file descriptor for the *_lock_file* as it is returned by the |
| 148 | # os.open() function. |
| 149 | # This file lock is only NOT None, if the object currently holds the |
| 150 | # lock. |
| 151 | self._lock_file_fd = None |
| 152 | |
| 153 | # The default timeout value. |
| 154 | self.timeout = timeout |
| 155 | |
| 156 | # We use this lock primarily for the lock counter. |
| 157 | self._thread_lock = threading.Lock() |
| 158 | |
| 159 | # The lock counter is used for implementing the nested locking |
| 160 | # mechanism. Whenever the lock is acquired, the counter is increased and |
| 161 | # the lock is only released, when this value is 0 again. |
| 162 | self._lock_counter = 0 |
| 163 | return None |
| 164 | |
| 165 | @property |
| 166 | def lock_file(self): |