Skip to content

Commit 382bc3b

Browse files
committed
impl. pcntl
1 parent 2b540ef commit 382bc3b

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/mutex/FlockMutex.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,9 @@ private function lockBlocking(): void
9797
*/
9898
private function lockPcntl(): void
9999
{
100-
$timebox = new PcntlTimeout($this->timeout);
100+
$timeoutInt = (int) ceil($this->timeout);
101+
102+
$timebox = new PcntlTimeout($timeoutInt);
101103

102104
try {
103105
$timebox->timeBoxed(
@@ -106,7 +108,7 @@ function (): void {
106108
}
107109
);
108110
} catch (DeadlineException $e) {
109-
throw TimeoutException::create($this->timeout);
111+
throw TimeoutException::create($timeoutInt);
110112
}
111113
}
112114

src/util/PcntlTimeout.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
*
1515
* This class requires the pcntl module and supports the cli sapi only.
1616
*
17+
* Only integer timeout is supported - https://github.com/php/php-src/issues/11828.
18+
*
1719
* @internal
1820
*/
1921
final class PcntlTimeout

0 commit comments

Comments
 (0)