@@ 153-159 (lines=7) @@ | ||
150 | * {@inheritdoc} |
|
151 | * @see \Generics\Lockable::lock() |
|
152 | */ |
|
153 | public function lock() |
|
154 | { |
|
155 | if ($this->locked || flock($this->handle, LOCK_SH) === false) { |
|
156 | throw new LockException("Could not acquire lock"); |
|
157 | } |
|
158 | $this->locked = true; |
|
159 | } |
|
160 | ||
161 | /** |
|
162 | * |
|
@@ 166-172 (lines=7) @@ | ||
163 | * {@inheritdoc} |
|
164 | * @see \Generics\Lockable::unlock() |
|
165 | */ |
|
166 | public function unlock() |
|
167 | { |
|
168 | if (! $this->locked || flock($this->handle, LOCK_UN) === false) { |
|
169 | throw new LockException("Could not release lock"); |
|
170 | } |
|
171 | $this->locked = false; |
|
172 | } |
|
173 | ||
174 | /** |
|
175 | * |
@@ 223-229 (lines=7) @@ | ||
220 | * {@inheritdoc} |
|
221 | * @see \Generics\Lockable::lock() |
|
222 | */ |
|
223 | public function lock() |
|
224 | { |
|
225 | if ($this->locked || flock($this->handle, LOCK_EX) === false) { |
|
226 | throw new LockException("Could not acquire lock"); |
|
227 | } |
|
228 | $this->locked = true; |
|
229 | } |
|
230 | ||
231 | /** |
|
232 | * |
|
@@ 236-242 (lines=7) @@ | ||
233 | * {@inheritdoc} |
|
234 | * @see \Generics\Lockable::unlock() |
|
235 | */ |
|
236 | public function unlock() |
|
237 | { |
|
238 | if (! $this->locked || flock($this->handle, LOCK_UN) === false) { |
|
239 | throw new LockException("Could not release lock"); |
|
240 | } |
|
241 | $this->locked = false; |
|
242 | } |
|
243 | ||
244 | /** |
|
245 | * |