Browse thread
[Caml-list] Best way to synchronize OS processes?
-
Ranjan Bagchi
- Richard Jones
-
Shawn Wagner
-
Ranjan Bagchi
- Jean-Christophe Filliatre
- Ranjan Bagchi
- Alex Baretta
-
Ranjan Bagchi
- Shawn Wagner
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2004-05-12 (07:11) |
From: | Jean-Christophe Filliatre <Jean-Christophe.Filliatre@l...> |
Subject: | Re: [Caml-list] Best way to synchronize OS processes? |
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