in reply to Re: Frustration with changing lock type
in thread Frustration with changing lock type

Am I missing the point or are you over complicating the problem.

Yes. :-) The exclusive lock means that we can do our task. The LOCK_EX is nonblocking so that if another task has it LOCK_SH it means the task is in process. The follow up LOCK_SH is meant to be blocking so that we dont try to read the tasks owner until it has finished writing to the lockfile.

Why not just block for lock or ask for a LOCK_EX|LOCK_NB and if you don't get it loop, sleeping 1 retying until you timeout or get lock?

Because I wanted to know the status and owner of the previous attempt basically. I know its not a good reason but I wanted to know, and things didnt work as I expected. :-)


---
demerphq

    First they ignore you, then they laugh at you, then they fight you, then you win.
    -- Gandhi