Hello!
I have searched google a bit and did some experiments, however, I am
unable to understand what is at issue with this example code listed.
Basically, I am trying to get some ruby code over to jruby so that I can
take advantage of threads and I anm running into lots of problems. Here
is what I have reduced one problem down to:
threadPool = []
list = %w(aS bS cS dS eS fS gS hS)
for sys in list
threadPool << Thread.new(sys) {|numericalSys|
while 1
res = %x[date]
puts “#{numericalSys}, #{res}\n”
sleep 2
end
}
end
threadPool.each {|eachThread| eachThread.join}
I am using jruby:
jruby --version
jruby 1.1.4 (ruby 1.8.6 patchlevel 114) (2008-08-28 rev 7570)
[sparc-java]
And here is the output of the process:
jruby t1.rb
null:1:inconst_missing': uninitialized constant Config::CONFIG (NameError) from <script>:1 from :1:in
initialize’
Under ruby proper I get what I thought should be the correct output:
ruby --version
ruby 1.8.7 (2008-08-11 patchlevel 72) [sparc-solaris2.10]
ruby t1.rb
aS, Tue Oct 14 19:14:01 GMT 2008
bS, Tue Oct 14 19:14:01 GMT 2008
cS, Tue Oct 14 19:14:01 GMT 2008
dS, Tue Oct 14 19:14:01 GMT 2008
eS, Tue Oct 14 19:14:01 GMT 2008
fS, Tue Oct 14 19:14:01 GMT 2008
gS, Tue Oct 14 19:14:01 GMT 2008
hS, Tue Oct 14 19:14:01 GMT 2008
aS, Tue Oct 14 19:14:03 GMT 2008
bS, Tue Oct 14 19:14:03 GMT 2008
dS, Tue Oct 14 19:14:03 GMT 2008
cS, Tue Oct 14 19:14:03 GMT 2008
gS, Tue Oct 14 19:14:03 GMT 2008
fS, Tue Oct 14 19:14:03 GMT 2008
eS, Tue Oct 14 19:14:03 GMT 2008
hS, Tue Oct 14 19:14:03 GMT 2008
…
Perhaps I am not completely understanding how I need to do this in jruby
so any assistance would be most welcome!
Thanks in advance!
Phy
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email