Skip to content

Regarding Lockhandler #12447

@GDmac

Description

@GDmac

Hello Lyrixx and others,

Regarding a specific comment by you, on the lockhandler thread.
Where you mention not doing unlink because of a potential race condition.
#10475 (comment)

If possible i would like your thoughts on the following.

(1) fopen() has a mode 'x' that allows to test if the file exist
and create it otherwise. it returns false if the file already exists.
According to this SO answer it's process is atomic:
http://stackoverflow.com/questions/15306771/php-fopen-x-flag-guaranteed-to-run-only-once

(2) This solution does however need a bit more elaborate cleanup,
otherwise, a stray lock file would prevent acquiring any new locks.
Currently in the _destruct() method, in my own implementation, i release the lock,
but also do some tests if the file exists, and if so, test if i can acquire a lock.
if the lock could be acquired, it was a stray file and can then be unlinked.

I would appreciate your thoughts,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions