[Ironruby-core] Threads in IronRuby

Ivan Porto Carrero ivan at flanders.co.nz
Thu Aug 27 14:28:53 EDT 2009


Hi
I just took a look at using xmpp4r with IronRuby.
Below you find the contents of my console session (I get the same result on
windows). You can probably do the same without having a jabber server
running locally :)

+ivan at ivan-mbp:~/projects/xmpp_spike
(master)» *ir*
IronRuby 0.9.0.0 on Mono 2.4.2.3
Copyright (c) Microsoft Corporation. All rights reserved.

>>> *csproj = ENV['CS_PROJECT_ROOT']*
=> "/Users/ivan/projects/cloudslide"
>>> *$:.unshift "#{csproj}/vendor/ruby/xmpp4r/lib"*
=> ["/Users/ivan/projects/cloudslide/vendor/ruby/xmpp4r/lib",
"/Users/ivan/projects/cloudslide/infrastructure/ironruby/lib",
"/Users/ivan/projects/cloudslide/infrastructure/ironruby/lib/ironruby",
"/Users/ivan/projects/cloudslide/infrastructure/ironruby/lib/ruby/site_ruby/1.8/",
"/Users/ivan/projects/cloudslide/infrastructure/ironruby/lib/ruby/site_ruby/",
"/Users/ivan/projects/cloudslide/infrastructure/ironruby/lib/ruby/1.8/",
"."]
>>> *include Jabber*
:0:in `const_missing': uninitialized constant Object::Jabber (NameError)
from :0

>>> *require 'xmpp4r/client'*
=> true  # <= this seems to work :)
>>> *include Jabber*
=> Object
>>> *client = Client.new(JID::new('ruby-test at cloudslide.local'))*
=> #<Jabber::Client:0x0000070 @fd=nil, @status=1,
@xmlcbs=#<Jabber::CallbackList:0x0000072 @list=[]>,
@stanzacbs=#<Jabber::CallbackList:0x0000074 @list=[]>,
@messagecbs=#<Jabber::CallbackList:0x0000076 @list=[]>,
@iqcbs=#<Jabber::CallbackList:0x0000078 @list=[]>,
@presencecbs=#<Jabber::CallbackList:0x000007a @list=[]>,
@send_lock=IronRuby.StandardLibrary.Threading.RubyMutex, @last_send=Thu Aug
27 18:43:18 +02:00 2009, @exception_block=nil,
@tbcbmutex=IronRuby.StandardLibrary.Threading.RubyMutex, @threadblocks=[],
@wakeup_thread=nil, @streamid=nil, @streamns="jabber:client",
@features_sem=#<Jabber::Semaphore:0x000007c @tickets=0,
@lock=IronRuby.StandardLibrary.Threading.RubyMutex,
@cond=IronRuby.StandardLibrary.Threading.RubyConditionVariable>,
@parser_thread=nil, @processing=0, @host=nil, @port=nil,
@allow_tls="constant", @tls=false, @ssl_capath=nil, @ssl_verifycb=nil,
@features_timeout=10, @keepalive_interval=60, @use_ssl=false,
@jid=#<Jabber::JID:0x000006e @resource=nil, @domain="cloudslide.local",
@node="ruby-test">>
>>> *client.connect 'localhost'*
=> Hit Ctrl-C here after a few minutes
mscorlib:0:in `Wait': Thread was being aborted
(System::Threading::ThreadAbortException)
 from :0:in `wait'
from
/Users/ivan/projects/cloudslide/vendor/ruby/xmpp4r/lib/xmpp4r/semaphore.rb:23:in
`wait'
 from :0:in `synchronize'
from
/Users/ivan/projects/cloudslide/vendor/ruby/xmpp4r/lib/xmpp4r/stream.rb:331:in
`wait'
 from
/Users/ivan/projects/cloudslide/vendor/ruby/xmpp4r/lib/xmpp4r/stream.rb:397:in
`send'
from
/Users/ivan/projects/cloudslide/vendor/ruby/xmpp4r/lib/xmpp4r/client.rb:88:in
`start'
 from
/Users/ivan/projects/cloudslide/vendor/ruby/xmpp4r/lib/xmpp4r/connection.rb:78:in
`connect'
from
/Users/ivan/projects/cloudslide/vendor/ruby/xmpp4r/lib/xmpp4r/client.rb:70:in
`connect'
 from :0
from mscorlib:0:in `CallSite.Target'
from Microsoft.Scripting.Core:0:in `invoke_object__this___Func`5<object,
Proc, object, object, object>_object_Proc_object_object'


On the server I see the connection coming in.

=INFO REPORT==== 2009-08-27 18:52:00 ===
I(<0.262.0>:ejabberd_listener:116) : (#Port<0.3531>) Accepted connection
{{127,0,0,1},61314} -> {{127,0,0,1},5222}

Can it be that the Thread implementation is in need of some attention?
---
Met vriendelijke groeten - Best regards - Salutations
Ivan Porto Carrero
Blog: http://flanders.co.nz
Twitter: http://twitter.com/casualjim
Author of IronRuby in Action (http://manning.com/carrero)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20090827/b1c7be8b/attachment.html>


More information about the Ironruby-core mailing list