Blocking Calls on Win32 Ruby

B

Bret Pettichord

I am running into several problems with some Ruby code. It was written on a
Mac and i am trying to get it to run on my Windows box. I am using the
Win32 Ruby 1.6.8. I've done some reading around and it seems that the
problems i am seeing are caused by something i read about.

Apparently, certain blocking calls block all threads rather than just their
own thread. This is apparently the consequent of the use of pthreads.

My next step is to try the same code with cygwin ruby or linux ruby. (I
don't have a mac). I understand that both of these use better-behaved threads.

Am i on track here? Have i misunderstood something terribly? Are there
plans to change this with 1.8 or later?

Bret

_____________________________________
Bret Pettichord, Software Tester
Book - www.testinglessons.com
Consulting - www.pettichord.com
Blog - www.io.com/~wazmo/blog
Hotlist - www.testinghotlist.com
 
P

Paul

Bret - I had the same issues on Windows. I was trying to use the
serial port with an FXRuby gui. I ended up having the serial driver in
a seperate ruby script, talking to the main app with drb
 
S

Shashank Date

Bret Pettichord said:
Apparently, certain blocking calls block all threads rather than just their
own thread. This is apparently the consequent of the use of pthreads.

Yes, for example calls to gets in a thread will block all other threads.
But I don't think this has anything to do with pthreads. (See lines 8006
onwards of eval.c)
My next step is to try the same code with cygwin ruby or linux ruby. (I
don't have a mac). I understand that both of these use better-behaved
threads.

At least the gets problem goes away on Cygwin.
Have i misunderstood something terribly?

Not really ... if you could show the code we can talk about the specifics.
HTH,
-- shanko
 
B

Bret Pettichord

Not really ... if you could show the code we can talk about the specifics.
HTH,

Well, i am porting 18,000 lines of ruby originally written on the Mac so
that they will run on Windows. Do you want me to send all of it to you?

OK. Here's an update. I've got all that code working (except for a few
minor problems) using the cygwin ruby. That's cool.

The problem is that i need to hook up that code, which is a web
application, to some ruby scripts that drive Internet Explorer's COM
interface. Guess what? That code will only work on mswin32 ruby because
cygwin doesn't support OLE/COM.

This was what i want to do:
- start the web application in a separate thread/process
- run the tests using IEC
- stop the web application.

My head has been hurting all day as i try to go back and forth from
thinking in cygwin ruby vs mswin32 ruby. I think i can do this if i put the
main thread in cygwin ruby and then have it spawn one thread/process to run
the server in cygwin ruby and other thread/process to run the iec tests in
mswin32 ruby.

Honestly, it is making me think that Python looks pretty good in comparison.

Bret


_____________________________________
Bret Pettichord, Software Tester
Book - www.testinglessons.com
Consulting - www.pettichord.com
Blog - www.io.com/~wazmo/blog

Homebrew Automation Seminar
March 19, Redmond, Washington
www.sasqag.org/99days/#automation
 
S

Shashank Date

Well, i am porting 18,000 lines of ruby originally written on the Mac so
that they will run on Windows. Do you want me to send all of it to you?

Whoa ! That is a lot of code ...not sure if I can handle it ;-)
OK. Here's an update. I've got all that code working (except for a few
minor problems) using the cygwin ruby. That's cool.

Yes, cool !
The problem is that i need to hook up that code, which is a web
application, to some ruby scripts that drive Internet Explorer's COM
interface. Guess what? That code will only work on mswin32 ruby because
cygwin doesn't support OLE/COM.

Unfortunately, yes.
This was what i want to do:
- start the web application in a separate thread/process
- run the tests using IEC
- stop the web application.

Take a look at win32-process 0.1.0 It provides fork() functionality, albeit
with some limitations.
My head has been hurting all day as i try to go back and forth from
thinking in cygwin ruby vs mswin32 ruby. I think i can do this if i put the
main thread in cygwin ruby and then have it spawn one thread/process to run
the server in cygwin ruby and other thread/process to run the iec tests in
mswin32 ruby.

My head hurts just by reading it !
Honestly, it is making me think that Python looks pretty good in
comparison.

PyWin32 is very feature rich.

-- shanko
 
S

Shashank Date

Bret Pettichord said:
I got the two kinds of ruby to run in parallel using drb to allow one to
make calls in the other. Works slick!

I bet it does ! And now it is instantly distributed too !
You have the possibility of running the iec tests on multiple machines
simultaneously ... without knowing the exact nature of these tests, I don't
know if this even makes sense.

Any chance of the software being open-source ? Just being greedy ;-)

-- shanko
PS> Did you pursue the PyWin32 approach any further?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top