From: Tim Bates Date: 2002-12-18T19:48:49+09:00 Subject: Re: $SAFE block? On Wed, 18 Dec 2002 09:14 pm, nobu.nokada@softhome.net wrote: > module Kernel > def safe(level) > proc {$SAFE = level; yield}.call > end > end > > p Thread.current.safe_level # => 0 > p safe(4) { Thread.current.safe_level } # => 4 > p Thread.current.safe_level # => 0 Much better! It doesn't use more threads, which is what I was looking for. I didn't realise Proc reset $SAFE at its end. Thanks a lot. And thanks to the person who submitted the other solution, even if it wasn't what I wanted. Tim Bates -- tim@bates.id.au