diff --git a/src/FileMutex.php b/src/FileMutex.php index 0881bdf..d4b4392 100644 --- a/src/FileMutex.php +++ b/src/FileMutex.php @@ -7,6 +7,7 @@ use Amp\Sync\Mutex; use Amp\Sync\SyncException; use function Amp\delay; +use const Amp\Process\IS_WINDOWS; final class FileMutex implements Mutex { @@ -39,7 +40,7 @@ public function acquire(?Cancellation $cancellation = null): Lock // so set an asynchronous timer and try again. for ($attempt = 0; true; ++$attempt) { try { - $file = $this->filesystem->openFile($this->fileName, 'c'); + $file = $this->filesystem->openFile($this->fileName, 'a'); if ($file->lock(LockMode::Exclusive)) { return new Lock(fn () => $this->release($file)); }