On Thu, Feb 17, 2005 at 10:20:58PM -0800, Michele Simionato wrote:
> Ok, I have yet another question: what is the difference
> between fcntl.lockf  and fcntl.flock? The man page of
> my Linux system says that flock is implemented independently
> of fcntl, however it does not say if I should use it in preference
> over fcntl or not.

it depends on what you want to do: as the manpages say, flock is
present on most Unices, but lockf is POSIX; flock is BSD, lockf is
SYSV (although its in XPG4.2, so you have it on newer Unices of any
flavor); on Linux, lockf works over NFS (if the server supports it),
and gives you access to mandatory locking if you want it. You can't
mix lockf and flock (by this I mean: you can get a LOCK_EX via flock
and via lockf on the same file at the same time).

So: use whichever you feel more comfortable with, although if you are
pretty confident your program will run mostly on Linux there is a bias
towards lockf given its extra capabilities there.

-- 
John Lenton ([EMAIL PROTECTED]) -- Random fortune:
กก  QQuuiittaa  eell  LLooccaall  EEcchhoo,,  MMaannoolloo  !!

Attachment: signature.asc
Description: Digital signature

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to