caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Olivier Andrieu <andrieu@ijm.jussieu.fr>
To: caml-list@inria.fr
Cc: will@exomi.com, alex@baretta.com, shawnw@speakeasy.org,
	ranjan.bagchi@frotz.com
Subject: Re: [Caml-list] Best way to synchronize OS processes?
Date: Wed, 12 May 2004 15:16:08 +0200 (CEST)	[thread overview]
Message-ID: <20040512.151608.113530062.andrieu@ijm.jussieu.fr> (raw)
In-Reply-To: <F7936C6B-A409-11D8-A5D1-000393863F70@exomi.com>

 Ville-Pertti Keinonen [Wed, 12 May 2004]:
 > 
 > On May 12, 2004, at 2:27 PM, Alex Baretta wrote:
 > 
 > > I disagree. I faced the same problem and found that it cannot be 
 > > easily solved with lockf. Unix.lockf locks specific regions in a file, 
 > > whereas Ranjan seems to need the equivalent of a mutex, which should 
 > > be implemented as a lock over the entire file. This is done by the 
 > > flock primitive in Posix systems. Unluckily, flock has not been 
 > > included in the Unix module.
 > 
 > Actually flock is non-POSIX (it's BSD) and is missing from some 
 > reasonably modern systems.
 > 
 > It's entirely possible to lock the entire file using the fcntl used by 
 > Unix.lockf, making it equivalent to flock.  

They are not *exactly* equivalent: flock does not work on NFS
filesystems whereas fnctl does, and they have different behaviour with
exec or dup I believe.

 > The problem is that the OCaml Unix module doesn't allow the
 > l_whence parameter to be set, which is a serious omission.

Well, it follows the lockf API, which starts the lock at the current
file position. You could use lseek to reposition it but this may confuse
a Pervasives channel buffering this file.

By the way, lockf can block, waiting for a lock. Shouldn't there be
some enter_blocking_section()/leave_blocking_section() somewhere ?

-- 
   Olivier

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


  reply	other threads:[~2004-05-12 13:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-11 18:05 Ranjan Bagchi
2004-05-11 18:09 ` Shawn Wagner
2004-05-11 18:24   ` Ranjan Bagchi
2004-05-12  7:01     ` Jean-Christophe Filliatre
2004-05-12 16:35     ` Ranjan Bagchi
2004-05-12 11:27   ` Alex Baretta
2004-05-12 11:46     ` Ville-Pertti Keinonen
2004-05-12 13:16       ` Olivier Andrieu [this message]
2004-05-12 12:53     ` Gerd Stolpmann
2004-05-11 18:10 ` Richard Jones
2004-05-12 16:52 ` Shawn Wagner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040512.151608.113530062.andrieu@ijm.jussieu.fr \
    --to=andrieu@ijm.jussieu.fr \
    --cc=alex@baretta.com \
    --cc=caml-list@inria.fr \
    --cc=ranjan.bagchi@frotz.com \
    --cc=shawnw@speakeasy.org \
    --cc=will@exomi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).