From: John Bob Date: 2009-07-26T21:50:07+09:00 Subject: Re: C extension and Ruby threads Takehiro Kubo wrote: > On Sun, Jul 26, 2009 at 8:47 PM, KUBO Takehiro wrote: >> How about rb_thread_polling() and WaitForSingleObject(handle, 0)? > > Sorry, rb_thread_polling() returns immediately if only one thread runs. > rb_thread_wait_for() should be used instead. > > while ((result = WaitForSingleObject(handle, 0)) == WAIT_TIMEOUT) { > struct timeval tv; > tv.sec = 0; > tv.usec = 100000; > rb_thread_wait_for(rv); /* sleep 0.1 second */ > } I used the rb_thread_blocking_region method, seems to work like a charm! Thanks a lot for your help. -- Posted via http://www.ruby-forum.com/.