Mega Code Archive
Categories
/
Ruby
/
Threads
Manipulate variables from the outer scope
x = 1 y = 2 thread3 = Thread.new do sleep(rand(0)) x = 3 end sleep(rand(0)) puts x