------ art_721_27121742.1151634534274 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline My guess would be that runMessageCycle never returns (until the while loop breaks, anyway) so Ruby never gets a chance to execute any more code. The C code in the extension doesn't know anything about Ruby's thread scheduler. I haven't tried this, but what if you called rb_thread_select with an empty descriptor set on each pass through the while loop? On 6/29/06, Victor 'Zverok' Shepelev <vshepelev / imho.com.ua> wrote: > > Hi all. > I've tried the simple code: > > Thread.new{ runMessageCycle} > puts 'here' > > where runMessageCycle is a simple C extension method with Win32 message > cycle: > > static VALUE run(VALUE _self) > { > MSG msg; > while (::GetMessage(&msg, NULL, 0, 0)) > { > ::TranslateMessage(&msg); > ::DispatchMessage(&msg); > } > > return _self; > } > > I'm very surprised that Thread.new don't returns ("here" will be never > printed). > What is silly with my code? > > Thanks, > Victor. > > > ------ art_721_27121742.1151634534274--