Skip to content

Commit

Permalink
Swap for do-while loop
Browse files Browse the repository at this point in the history
  • Loading branch information
trowski committed Aug 3, 2024
1 parent de3d8d4 commit 217097b
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/PosixSemaphore.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,9 @@ public static function create(int $maxLocks, int $permissions = 0600): self

try {
do {
$id = self::getNextId();
while (\msg_queue_exists($id)) {
do {
$id = self::getNextId();
}
} while (\msg_queue_exists($id));

if ($queue = \msg_get_queue($id, $permissions)) {
$semaphore = new self($queue, $id, \getmypid());
Expand Down

0 comments on commit 217097b

Please sign in to comment.