

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
21 messages in org.ruby-lang.ruby-talkRe: C Threads and Ruby| From | Sent On | Attachments |
|---|---|---|
| Kroeger, Simon (ext) | Jun 20, 2006 3:27 am | |
| Patrick Hurley | Jun 20, 2006 4:28 am | |
| Kroeger, Simon (ext) | Jun 20, 2006 4:59 am | |
| Francis Cianfrocca | Jun 20, 2006 5:13 am | |
| Patrick Hurley | Jun 20, 2006 9:39 am | |
| Paul Brannan | Jun 20, 2006 11:33 am | |
| Patrick Hurley | Jun 20, 2006 1:16 pm | |
| Francis Cianfrocca | Jun 20, 2006 1:17 pm | |
| Francis Cianfrocca | Jun 20, 2006 1:19 pm | |
| Simon Kröger | Jun 20, 2006 2:29 pm | |
| Joel VanderWerf | Jun 20, 2006 2:35 pm | |
| Francis Cianfrocca | Jun 20, 2006 2:39 pm | |
| Bill Kelly | Jun 20, 2006 2:42 pm | |
| Simon Kröger | Jun 20, 2006 2:49 pm | |
| Francis Cianfrocca | Jun 20, 2006 3:26 pm | |
| Francis Cianfrocca | Jun 20, 2006 3:34 pm | |
| Bill Kelly | Jun 20, 2006 4:08 pm | |
| Francis Cianfrocca | Jun 20, 2006 5:07 pm | |
| Kroeger, Simon (ext) | Jun 21, 2006 2:53 am | |
| Francis Cianfrocca | Jun 21, 2006 3:15 am | |
| Paul Brannan | Jun 22, 2006 8:21 am |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | Re: C Threads and Ruby | Actions... |
|---|---|---|
| From: | Francis Cianfrocca (garb...@gmail.com) | |
| Date: | Jun 21, 2006 3:15:03 am | |
| List: | org.ruby-lang.ruby-talk | |
Simon:
Well.. ??? yes of course, if you block the one and only thread
on an IO operation that never returns your program will block forever. This should be true for linux also, right? <<<
It has nothing to do with threads. I only took a quick look at the Ruby source code, but I suspect there is a bug in the Windows implementation. Remember, I got the same result as you did even when I took out your thread. And it did work fine on both Linux and OSX. Ruby's green threads implementation does not block the whole process when waiting for an I/O because its scheduler interacts with multiplexed I/O.
native Win32 means calling 'CreatePipe' instead of '_pipe' ?
do you have code for a platform independent implementation? (using #ifdef) <<<
Windows does have Unix-like calls for doing this. (They're wrappers over Win32 APIs.) I forget which one I've used but I think it was pipe(). Also, there may be something in Daniel Berger's win32 library that may help you.
On 6/21/06, Kroeger, Simon (ext) <simo...@siemens.com> wrote:
From: Francis Cianfrocca [mailto:garb...@gmail.com] Sent: Wednesday, June 21, 2006 12:26 AM
The problem isn't that rd.gets waits forever - i didn't described my problem well enough obviously. The problem is: i get 4 foo!s not one more. Not only the main thread blocks at the gets but all other ruby threads do also block. This defeats the whole purpose of using a pipe in the first place.
Yes, this does fail on Windows as written (works fine on Unix), but it has nothing to do with threads. Take out the thread altogether and it will still block forever.
Well.. ??? yes of course, if you block the one and only thread on an IO operation that never returns your program will block forever. This should be true for linux also, right?
So the problem is that all threads block because of this IO operation, how could that be unrelated to threads?
Try writing an extension in C and create your descriptors in native Win32 code. Those will definitely work with Ruby on both Windows and Unix (I've done it). You may have to create two pairs because they will be half-duplex on Windows.
native Win32 means calling 'CreatePipe' instead of '_pipe' ? do you have code for a platform independent implementation? (using #ifdef)
for the record: ruby 1.9.0 (2006-04-15) [i386-mswin32] seems to have a fix for that problem.
cheers
Simon







