Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

(it's dumb) Re: DON'T USE THIS CODE

by PodMaster (Abbot)
on Sep 16, 2002 at 09:47 UTC ( #198196=note: print w/replies, xml ) Need Help??

in reply to DON'T USE THIS CODE
in thread File::DumbLock

I --ed you.

I say in pod

File::DumbLock implements the dumbest kind of "locking" mechanism known to man. It's voluntary, and it can backfire, but virtually every plaform suports it.

Most of your comments fall apart in face of that statement.

Flock is not supported on win9x.

I think people are --ing you because you haven't offered any alternatives, and thus your statements sound smart-alecky.

I certainly would like to know what

ways of executing "atomic" test-and-set operations
are for win9x.

Are you talking about attempting to create a "lock directory" instead of a lock file (now that I think about it, that's what i'll change it to do)?

I for one would like to know( i do say above: "If you know of a module that already exists that does this, please /tell me", did I have to also say if you know a better flockless way, tell me?)

** The Third rule of perl club is a statement of fact: pod is sexy.

Replies are listed 'Best First'.
•Re: (it's dumb) Re: DON'T USE THIS CODE
by merlyn (Sage) on Sep 16, 2002 at 13:51 UTC
    Look, your code breaks on every platform. It's dangerous. It will start to spread a bad meme to most of the other platforms, and we don't need that.

    You have not contributed anything to the art. You have only muddied the water.

    perlport says that flock works on Win2K. Hence, the solutions I wrote nearly seven years ago for Unix work fine on Win2K today. The only place this breaks down is on older win95 and win98 releases. For that, your solution offers nothing that works consistently, and even definitely fails because you are performing time-related operations in separate steps, and would be a step backwards for the community at large.

    You have not solved a thing with your post. You have only harmed the community. Thus, I stepped in to try to mark this code as bad as quick as I could.

    -- Randal L. Schwartz, Perl hacker

      Well thank you for helping. You've certainly solved my dilemma.

      Ok, so what do you think of File::FlockDir? (i just ran accross it)

      ** The Third rule of perl club is a statement of fact: pod is sexy.

Re: (it's dumb) Re: DON'T USE THIS CODE
by valdez (Monsignor) on Sep 16, 2002 at 13:57 UTC

    One example strategy could be unlink: you try to delete something and check for the result. If you succeeded, you obtained the lock. This approach makes things more complicated for stale locks...

    Ciao, Valerio

    update: thanks podmaster for the hint.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://198196]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (2)
As of 2023-03-21 04:34 GMT
Find Nodes?
    Voting Booth?
    Which type of climate do you prefer to live in?

    Results (59 votes). Check out past polls.