Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re: (tye)Re: flock() broken under FreeBSD?

by dawidge (Initiate)
on Jul 28, 2002 at 08:20 UTC ( #185826=note: print w/replies, xml ) Need Help??

in reply to (tye)Re: flock() broken under FreeBSD?
in thread flock() broken under FreeBSD?

The FreeBSD man pages hint at this behavior:

A shared lock may be upgraded to an exclusive lock, and vice versa, sim­ply by specifying the appropriate lock type; this results in the previous lock being released and the new lock applied (possibly after other pro­cesses have gained and released the lock).

Requesting a lock on an object that is already locked normally causes the caller to be blocked until the lock may be acquired. If LOCK_NB is included in operation, then this will not happen; instead the call will fail and the error EWOULDBLOCK will be returned.

So, if you try to upgrade your shared lock, you release the lock and get in line behind everyone else blocked for an exclusive lock. If you try to upgrade your exlusive lock to a shared lock, you release the exclusive lock and get in line (behind everyone blocking for an exclusive lock) for a shared lock.
  • Comment on Re: (tye)Re: flock() broken under FreeBSD?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://185826]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2018-05-26 05:14 GMT
Find Nodes?
    Voting Booth?