Skip to content

Commit

Permalink
Merge 47359e5 into fe182e0
Browse files Browse the repository at this point in the history
  • Loading branch information
b1rdex committed Jul 22, 2020
2 parents fe182e0 + 47359e5 commit d2c1c6b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/mutex.md
Expand Up @@ -4,7 +4,7 @@ permalink: /mutex
---
[Mutual exclusion](https://en.wikipedia.org/wiki/Mutual_exclusion) can be achieved using `Amp\Sync\synchronized()` and any `Mutex` implementation, or by manually using the `Mutex` instance to acquire a lock.

Locks are acquired using `Mutex::acquire()`, which returns a `Promise` that resolves to an instance of `Lock` once the lock as been successfully acquired.
Locks are acquired using `Mutex::acquire()`, which returns a `Promise` that resolves to an instance of `Lock` once the lock has been successfully acquired.

As long as the resulting `Lock` object isn't released using `Lock::release()` or by being garbage collected, the holder of the lock can exclusively run some code as long as all other parties running the same code also acquire a lock before doing so.

Expand All @@ -31,4 +31,4 @@ function writeExclusively(Amp\Sync\Mutex $mutex, string $filePath, string $data)
yield $this->fileHandle->write($data);
});
}
```
```

0 comments on commit d2c1c6b

Please sign in to comment.