Actually, this is a bug in ConditionVariable, and we have RubySpec tags for the ConditionVariable to disable some failing specs. ConditionVariable used Monitor.Pulse to implement ConditionVariable#wait which will yield control only if there is a waiting thread; otherwise the pulse is ignored. So we need to use AutoResetEvent.
I have opened bug http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=3151 and attached a fix to it. I am gone on vacation, so someone will have to get it checked in. From: Shri Borde Sent: Saturday, November 21, 2009 4:31 PM To: ironruby-core@rubyforge.org Subject: RE: [Ironruby-core] ironruby RC1 The comment for the “val” parameter says “number of threads, that can enter to section”, and so it seems reasonable that it should be atleast 1. I wonder if this just happens to work in MRI because “run” gets called before “wait”. This could happen predictably with MRI’s green threads because the scheduler has fixed rules of which thread gets scheduled, and so the chances of races is low even on a multiproc machine. Could you check if this theory is true by adding logging to the methods and running with MRI? If it is correct, then we will have to figure out if/why xmpp4r expects to call “run” first, and how to get this to happen with IronRuby. From: ironruby-core-boun...@rubyforge.org [mailto:ironruby-core-boun...@rubyforge.org] On Behalf Of Ivan Porto Carrero Sent: Saturday, November 21, 2009 7:39 AM To: ironruby-core@rubyforge.org Subject: Re: [Ironruby-core] ironruby RC1 I needed to add I managed to connect by initializing the tickets with another value than 0. I set it to 1 --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Google Wave: portocarrero.i...@googlewave.com<mailto:portocarrero.i...@googlewave.com> Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) On Sat, Nov 21, 2009 at 4:37 PM, Ivan Porto Carrero <i...@flanders.co.nz<mailto:i...@flanders.co.nz>> wrote: I know it has something to do with Threading and the value of @tickets in this class. I've just managed to connect with xmpp4r to my jabber server :=D but then the stream is closed so you can't actually send messages etc. They have this class: ## # This class implements semaphore for threads synchronization. class Semaphore ## # Initialize new semaphore # # val:: [Integer] number of threads, that can enter to section def initialize(val=0) @tickets = val @lock = Mutex.new @cond = ConditionVariable.new end ## # Waits until are available some free tickets def wait @lock.synchronize { @cond.wait(@lock) while !(@tickets > 0) @tickets -= 1 } end ## # Unlocks guarded section, increments number of free tickets def run @lock.synchronize { @tickets += 1 @cond.signal } end end --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Google Wave: portocarrero.i...@googlewave.com<mailto:portocarrero.i...@googlewave.com> Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) On Sat, Nov 21, 2009 at 2:28 PM, Jimmy Schementi <jimmy.scheme...@microsoft.com<mailto:jimmy.scheme...@microsoft.com>> wrote: The RC1 bits will be in GIT shortly … looks like the pushes to GIT haven’t been happening/working. Also, the RC1 “announcement” and other things from my RubyConf talk will make their way online over the next couple of days, but in short this release is “RC1” because we want more people to start using it and find blocking bugs. WRT xmpp4r, it’d be great if you could investigate what the actual bug is; a small repro will drastically increase the chances of it being fixes in the near future, especially when it’s a library failing for some strange reasons. ~js From: ironruby-core-boun...@rubyforge.org<mailto:ironruby-core-boun...@rubyforge.org> [mailto:ironruby-core-boun...@rubyforge.org<mailto:ironruby-core-boun...@rubyforge.org>] On Behalf Of Ivan Porto Carrero Sent: Saturday, November 21, 2009 12:06 AM To: ironruby-core Subject: [Ironruby-core] ironruby RC1 Hi I don't get any changes coming in for the repo for the last 3 days, are those changes that make up RC1 in? Then on a side note I'm still unable to run xmpp4r with IronRuby. it should work but gets stuck in waiting for a thread that never returns. --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Google Wave: portocarrero.i...@googlewave.com<mailto:portocarrero.i...@googlewave.com> Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) _______________________________________________ Ironruby-core mailing list Ironruby-core@rubyforge.org<mailto:Ironruby-core@rubyforge.org> http://rubyforge.org/mailman/listinfo/ironruby-core
_______________________________________________ Ironruby-core mailing list Ironruby-core@rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core