From: matz@... (Yukihiro Matsumoto) Date: 2001-09-25T22:52:34+09:00 Subject: [ruby-talk:21671] Re: Threads and $SAFE Hi, In message "[ruby-talk:21666] Threads and $SAFE" on 01/09/25, Carlos writes: |Can I change the $SAFE level in some parts of the script? I want to do |unsafe operations at the loaded script's demand, but only under my control. |Something like that: $SAFE is thread local value, and communication between thread using Queue permitted, so that set up safe thread for trusted operation, and untrusted thread ask it via queue. For example, Puts_queue = Queue.new Thread.new { loop { puts "called with #{Puts_queue.pop}" } } Thread.new { $SAFE=4 Puts_queue.push(1) }.join Hope this helps. matz.