While I question the sanity of wanting to delete the lockfile (you do realize that other processes may already have opened the file and are all waiting to grab the lock?), you can delete a file that's open. But imagine what could happen (am I assuming Unix semantics):
- Process 1 sysopens the file.
- Process 1 grabs the lock.
- Process 2 sysopens the file.
- Process 2 queues to get the lock.
- Process 3 sysopens the file.
- Process 3 queues to get the lock.
- Process 1 deletes the file. (Name gone; file still there(!))
- Process 1 releases the lock.
- Process 2 gets the lock and proceeds.
- Process 4 sysopens a new lockfile.
- Process 4 grabs the lock.
At this moment, you have two lock files, the old, now nameless one, and a new one. Both process 2 and 4 are in the critical section. Process 3 is still waiting, and will afterwards work with stale data.
Basically what will happen is that each process that will throw away your lockfile will open a new (but empty) queue. But the old queue won't be emptied.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.