Version française
Home     About     Download     Resources     Contact us    
Browse thread
Mutex and posix
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Alex Baretta <alex@b...>
Subject: Re: [Caml-list] Mutex and posix
Brian Hurt wrote:
> On Mon, 17 Jan 2005, Alex Baretta wrote:
> 
>>I am aware of this. But, if one really needs the timed primitive, one 
>>can always simulate it by sampling the mutex state repeatedly with 
>>_trylock. Unix.select serves the purpose of controlling the sampling time.

> 
> Um, no.  What happens if the mutex is unlocked for some period of time 
> between your polls, but relocked before you poll the lock again?  It's 
> very easy to hit livelock conditions doing this.
> 
> Brian

Of course it is. My solution is only a kludge to simulate an OS 
primitive on a system where it is not available. I am not stating that 
my strategy yields a POSIX compliant timedlock.

Alex


-- 
*********************************************************************
http://www.barettadeit.com/
Baretta DE&IT
A division of Baretta SRL

tel. +39 02 370 111 55
fax. +39 02 370 111 54

Our technology:

The Application System/Xcaml (AS/Xcaml)
<http://www.asxcaml.org/>

The FreerP Project
<http://www.freerp.org/>