From: Andre' Date: 2004-08-12T21:21:16+09:00 Subject: Re: Thread takeover I think I found out the problem. I'm using Win32, and I was using the DJGPP compilation of Ruby. In the MINGW compilation, it works smooth. Haven't tested it on Linux, though... but it should work. Andr� Em Wed, 11 Aug 2004 11:32:03 -0300, Andre' escreveu: > Strangely, I'm having the problem that one thread is taking over the > whole process. > > Imagine this main file: > > Thread.new { > class Main > def initialize > while true > print 1 > end > end > end > m = Main.new > } > Thread.new { > require 'p.rb' > m = Main.new > } > while true; end > > It has two threads: one is printing 1 all the time in the screen. I have > a second - external - that is exactly like the first, but it prints 2. > The 'p.rb' is this one: > > class Main > def initialize > while true > print 2 > end > end > end > > It acts as expected. (11112222221111111222222) > > But if I add the line "m = Main.new" at the end of 'p.rb', the thread > seems to take over! (22222222222222222222222222222222222) > > Since this 'p.rb' is some external file the users will input, I can't > tell what it'll be on it, so I can't avoid that a malicious code takes > over my program! Or can I? > -- (c) Andre' - All rights reseved - 2004