A
Andre'
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?
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?