English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] Best way to synchronize OS processes?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-05-11 (18:24)
From: Ranjan Bagchi <ranjan.bagchi@f...>
Subject: Re: [Caml-list] Best way to synchronize OS processes?
Cool - I was playing with that call today, although I'm getting 
occasional EDEADLK exceptions thrown though.  Is there an example of 
correct use? 

What I'm doing (code isn't handy right now) is before writing to the 
file, I get a write lock, write my bit, and then unlock the region.   
Reading bits try to get a Read lock, and then unlock when they're done.

I'm using | in_channel_of_descr| and out_channel_of_descr to do the i/o 
-- is this a problem?


Shawn Wagner wrote:

>On Tue, May 11, 2004 at 11:05:23AM -0700, Ranjan Bagchi wrote:
>>Hi --
>>I'm writing some code which will end up executing concurrently on 
>>several OS processes.  I'd like to serialize access to some specific OS 
>>resources (for instance, writing to a single file).  The Unix module 
>>doesn't appear to offer anything like a critical section or an OS 
>>mutex.  Is there a preferred way to do this?
>File locking with Unix.lockf?

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