Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Re: Filename from filehandle?

by Xxaxx (Monk)
on Apr 24, 2001 at 10:40 UTC ( [id://74976]=note: print w/replies, xml ) Need Help??


in reply to Re: Filename from filehandle?
in thread Filename from filehandle?

Could you talk more about "And beware of flock'ing filehandles that are already open... "?

I don't think I've ever applied a lock routine more than once. But now you've got my curiousity. What symptoms might occur if at some point I mess up and flock a file for the second time.

Sign me curious
Claude

Replies are listed 'Best First'.
Re (tilly) 3: Filename from filehandle?
by tilly (Archbishop) on Apr 25, 2001 at 02:25 UTC
    Here is the idea of what can happen:
    STEP 1: Wait for the first lock to be lost. STEP 2: Lose the first lock STEP 3: (Why don't we get here?)...
    This state of affairs is known as a "deadlock" and is usually considered Not Good.
Re: Re: Re: Filename from filehandle?
by clintp (Curate) on Apr 25, 2001 at 05:01 UTC
    Filehandles that are already opened (especially for writing) have may have already been modified, before the lock was applied. Consider:
    open(FOO, ">/tmp/foo") || die; # You've altered the file! flock(FOO, LOCK_EX) || warn; # And now you bother to lock it?
    Yeah, it's silly. But you'd be amazed at how often it happens.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2024-04-24 19:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found