From: Rick DeNatale Date: 2006-10-06T01:16:35+09:00 Subject: Re: Timeout and Exponetial Regexes On 10/5/06, eden wrote: > However, the point of my post is not the regex. What I was trying to > find out was why Ruby seems to block threads whenever a regex is > running. I'm not entirely sure, but I suspect that it's because of the use of green threads, rather than native threads. Native threads can get scheduled whenever there's a hardware interrupt. Thread switching for green threads only happens when certain internal functions are called e.g. rb_thread_schedule. I suspect that the regex engine isn't calling this, or if it does it doesn't call it very often. If this is the case it's not really blocking threads explicitly, but the effect is the same. Just a theory, I haven't slogged through the code thoroughly enough to prove it. -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.com/