From: ara.t.howard@... Date: 2006-05-02T03:55:45+09:00 Subject: Re: Generate unique filenames On Tue, 2 May 2006, Kirk Haines wrote: > On Monday 01 May 2006 12:00 pm, ara.t.howard@noaa.gov wrote: > >> it seems like that, but it does not. File::EXCL is broken on many >> filesystems and, worse, fails silently. one needs to use a tmpnam >> algorithm with hostname/pid/time/rand to minimize the chances of dup names >> or use a form of locking which works on all filesystems. afaik the only >> portable atomic fs operation is 'link' and, ergo, the locking mechanism >> must be built on top of this. my lockfile class has an impl if your > > The link implementation in your lockfile lib won't work right on, at the very > least Windows XP. > > I have a modified version of it in my IOWA dev tree that, if not told what > style of locking to do, tests the matter when a lockfile is first created and > attempts to guess at the appropriate flavor of lockfile. > > It is, currently, a less than wholly elegant integration with a somewhat > simplified version of your lockfile.rb, but it works and passes its tests on > WinXP as well as the couple different flavors of Linux I have tested on. cool. i've never even attempted this on any windowsy platform. maybe we should merge? a good lockfile class is a must for any production system, as anyone who's even come back from a 4 days weekend to find 4000 stacked and hung crontab processes knows ;-) cheers. -a -- be kind whenever possible... it is always possible. - h.h. the 14th dali lama