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 2:42:39 pm
List:org.ruby-lang.ruby-talk

From: "Simon Kröger" <Simo@gmx.de>

------------------------------- $stdout.sync = true rd, wr = IO.pipe

Thread.new do loop do puts 'foo!' sleep 0.5 end end

sleep 2 puts(rd.gets) -------------------------------

ruby 1.8.4 (2005-12-24) [i386-mswin32] gives me 4 foo!s and waits for the rest of eternity. So blocking on a pipe isn't an option for platform independent code. (or am I doing something wrong, please say I'm doing something wrong!)

As far as I know, on mswin32 ruby, the only genuine nonblocking I/O is with sockets.

I, too, have need to wake up a ruby thread from a native thread in my application. Currently I'm using polling.

My thinking was to use UDP over loopback. My ruby thread would sleep waiting for the C thread to send it a UDP packet.

I haven't tried this yet. I'm certain it would work, technically, but I'm wary of it because I've had experiences in the past where simply creating a socket (even on localhost) causes the user's computer to decide to take the modem off-hook and try to connect to their AOL account... :rolleyes:

(This was about six years ago. I'm not sure if Windows still behaves like that with dialup connections or not.)

Regards,

Bill