Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re^3: avoiding a race (read locks)

by Corion (Pope)
on Sep 28, 2010 at 15:48 UTC ( #862454=note: print w/replies, xml ) Need Help??

in reply to Re^2: avoiding a race (read locks)
in thread avoiding a race

See the following sentence in tye's scheme:

When you get [the write lock], you read from the position in the file that was the previous end of the file and update your decision as to whether you need to write.

So, in your example case, Process 321 would notice that the file changed since it last checked and that another process already sent the notification.

Replies are listed 'Best First'.
Re^4: avoiding a race (no longer EOF)
by tye (Sage) on Sep 28, 2010 at 17:28 UTC

    Thanks, Corion.

    I also should have pointed out that, in order to keep reading past what had previously been the end-of-file, you'll need to seek( $fh, 0, 0 ) (if you don't just re-open the file).

    - tye        

Re^4: avoiding a race (read locks)
by westy032001 (Novice) on Sep 29, 2010 at 15:07 UTC
    aha ! Thank you !

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2016-10-22 17:44 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (297 votes). Check out past polls.