Hi,

Am Donnerstag, 12. Jan 2006, 08:21:36 +0900 schrieb Mathieu Bouchard:
> On Thu, 12 Jan 2006, Bertram Scharpf wrote:
> >   File.open "somefile", "a" do |f|
> >     f.flock File::LOCK_EX do
> >       f.print ...
> >     end
> >   end
> 
> class File
>   def blocklock(x)
>     flock x
>     yield
>   ensure
>     flock LOCK_UN
>   end
> end
> 
> > My primary problem is how to handle exceptions that occur
> > while writing to the file.
> 
> use "ensure".

I _did_ use `rb_ensure' in my proposal. This was the tricky
part.

Concerning "-a"s thorough considerations I admit there's no
quick-to-shoot answer. Anyway, leaving LOCK_UN by itself
doesn't seem to be POLSy to me.

Bertram


> 

-- 
Bertram Scharpf
Stuttgart, Deutschland/Germany
http://www.bertram-scharpf.de