@@ 69-76 (lines=8) @@ | ||
66 | * @return void |
|
67 | * @throws LockException Thrown when the lock could not be created. |
|
68 | */ |
|
69 | public function blockTillLock() |
|
70 | { |
|
71 | $lockSucceeded = flock($this->fileHandle, LOCK_EX); |
|
72 | ||
73 | if (!$lockSucceeded) { |
|
74 | throw new LockException('An error occurred aquiring exclusive lock on ' . $this->filePath); |
|
75 | } |
|
76 | } |
|
77 | ||
78 | /** |
|
79 | * Checks if the lock is active. |
|
@@ 100-107 (lines=8) @@ | ||
97 | * @return void |
|
98 | * @throws LockException Thrown when the lock could not be released. |
|
99 | */ |
|
100 | public function release() |
|
101 | { |
|
102 | $releaseSucceeded = flock($this->fileHandle, LOCK_UN); |
|
103 | ||
104 | if (!$releaseSucceeded) { |
|
105 | throw new LockException('An error occurred releasing lock: ' . $this->filePath); |
|
106 | } |
|
107 | } |
|
108 | } |
|
109 |