Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flock-based File Mutex #86

Open
wants to merge 3 commits into
base: 3.x
Choose a base branch
from
Open

flock-based File Mutex #86

wants to merge 3 commits into from

Conversation

trowski
Copy link
Member

@trowski trowski commented Dec 6, 2024

An alternative to #80 which combines using flock with file deletion to make a best-effort to cleanup temporary files.

Comment on lines 46 to 47
$handle = \fopen($this->fileName, 'c');
if ($handle && \flock($handle, \LOCK_EX | \LOCK_NB)) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fopen is a blocking function, but assuming a local file is being opened this should be a reasonable trade-off, and the only way flock can be used in PHP to my knowledge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant