21 messages in org.ruby-lang.ruby-talkRe: C Threads and Ruby
FromSent OnAttachments
Kroeger, Simon (ext)Jun 20, 2006 3:27 am 
Patrick HurleyJun 20, 2006 4:28 am 
Kroeger, Simon (ext)Jun 20, 2006 4:59 am 
Francis CianfroccaJun 20, 2006 5:13 am 
Patrick HurleyJun 20, 2006 9:39 am 
Paul BrannanJun 20, 2006 11:33 am 
Patrick HurleyJun 20, 2006 1:16 pm 
Francis CianfroccaJun 20, 2006 1:17 pm 
Francis CianfroccaJun 20, 2006 1:19 pm 
Simon KrögerJun 20, 2006 2:29 pm 
Joel VanderWerfJun 20, 2006 2:35 pm 
Francis CianfroccaJun 20, 2006 2:39 pm 
Bill KellyJun 20, 2006 2:42 pm 
Simon KrögerJun 20, 2006 2:49 pm 
Francis CianfroccaJun 20, 2006 3:26 pm 
Francis CianfroccaJun 20, 2006 3:34 pm 
Bill KellyJun 20, 2006 4:08 pm 
Francis CianfroccaJun 20, 2006 5:07 pm 
Kroeger, Simon (ext)Jun 21, 2006 2:53 am 
Francis CianfroccaJun 21, 2006 3:15 am 
Paul BrannanJun 22, 2006 8:21 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: C Threads and RubyActions...
From:Bill Kelly (bil@cts.com)
Date:Jun 20, 2006 4:08:03 pm
List:org.ruby-lang.ruby-talk

From: "Francis Cianfrocca" <garb@gmail.com>

Try this: create a pipe or socketpair in native code. Then you can create a ruby IO object from the file-descriptor of the read-side of the pipe. Then call Ruby's select (NOT the native select) on the IO object. When it selects readable, you run your Ruby code. This blocks neither your native threads nor your other Ruby threads.

I know this works in both Unix and Windows, but the native code is slightly different.

Cool. I didn't realize one could wrap a native win32 pipe handle in some way that will work with ruby's select!

The impression I got from the windows select() documentation was that it only works with winsock sockets.

This makes me wonder why ruby wouldn't already be creating the "proper kind" of pipes and socketpairs that work with its select(), if it's that easy to create one myself and wrap it in a ruby IO object?

Strange . . .

Thanks,

Bill