POV-Ray : Newsgroups : povray.off-topic : More Haskell fanning : Re: More Haskell fanning Server Time
30 Jul 2024 02:29:38 EDT (-0400)
  Re: More Haskell fanning  
From: Florian Pesth
Date: 18 May 2011 18:53:21
Message: <4dd44de1@news.povray.org>
Am Wed, 18 May 2011 15:28:44 -0700 schrieb Darren New:

> On 5/18/2011 14:50, Florian Pesth wrote:
>> Sure that there is no call for saying "Lock this file definitely" and
>> the other lock mechanisms are just kept for POSIX compability?
> 
> Yes. The basic problem is that none of the lock mechanisms actually work
> reliably in all situations.
> 

How about this:

http://www.hackinglinuxexposed.com/articles/20030623.html

Granted, the described problem, that if a program opens before and writes 
after the lock (therefore overwriting the file) persists, but I don't 
think this is really a locking problem or is it?

>> I think this is also older...
> 
> One problem is that there's at least 3 ways of doing this in Linux, all
> three relatively recent.
> 
> One would give you a signal when a file in the one single directory
> you're watching (maybe just the cwd) changed. Not very handy except for
> the refreshing of a window in a file manager.
> 
> One would do some sort of something or other with messages sent to you
> somehow I forget when anything under a particular file tree changed,
> IIRC. It was poor because, IIRC, you had to block to wait for the
> messages or something.
> 
> The latest one, done right, lets you open a file handle, writing to the
> handle says what you're waiting to see change, reading the (selectable)
> handle lets you know when something there changed and what it was.

Ok, thanks. I just was thinking of tailf which advertises with hard disk 
spin down when the file does not change - so it definitely does not poll 
and is around since at least 2003. I just searched for it and it seems 
that there are two mechanisms: dnotify and the more recently inotify. Now 
they might not do what you like to do with them (sorry I didn't 
understand what you wanted to do exactly) but for being notified when a 
file changes (which is what Andrew was talking about) even dnotify seems 
to be fine (and is around since kernel 2.4.). Has your problem something 
to do with blocking / non-blocking access of this information?


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.