From: KUBO Takehiro Date: 2009-07-26T21:00:17+09:00 Subject: Re: C extension and Ruby threads 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 */  }