From: Jean-Christophe Filliatre <Jean-Christophe.Filliatre@lri.fr>
To: Ranjan Bagchi <ranjan.bagchi@frotz.com>
Cc: Shawn Wagner <shawnw@speakeasy.org>, caml-list@inria.fr
Subject: Re: [Caml-list] Best way to synchronize OS processes?
Date: Wed, 12 May 2004 09:01:50 +0200 [thread overview]
Message-ID: <16545.52190.503968.109730@gargle.gargle.HOWL> (raw)
In-Reply-To: <40A11A46.5020704@frotz.com>
Ranjan Bagchi writes:
> Cool - I was playing with that call today, although I'm getting
> occasional EDEADLK exceptions thrown though. Is there an example of
> correct use?
I use it like this (bd_lock is the lock file) :
======================================================================
...
(* START OF CRITICAL SECTION *)
let fd_lock =
try
let fd = openfile bd_lock [O_WRONLY; O_CREAT] 0o666 in
lockf fd F_LOCK 0;
fd
with e -> printf "%s" (Printexc.to_string e); exit 0
...CRITICAL SECTION GOES HERE...
let _ = lockf fd_lock F_ULOCK 0; close fd_lock
(* END OF CRITICAL SECTION *)
...
======================================================================
Hope this helps,
--
Jean-Christophe Filliâtre (http://www.lri.fr/~filliatr)
-------------------
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
next prev parent reply other threads:[~2004-05-12 7:11 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 [this message]
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
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=16545.52190.503968.109730@gargle.gargle.HOWL \
--to=jean-christophe.filliatre@lri.fr \
--cc=caml-list@inria.fr \
--cc=ranjan.bagchi@frotz.com \
--cc=shawnw@speakeasy.org \
/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