Professional Web Applications Themes

Blocking Calls on Win32 Ruby - Ruby

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). ...

  1. #1

    Default Blocking Calls on Win32 Ruby

    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



    Bret Guest

  2. #2

    Default Re: Blocking Calls on Win32 Ruby

    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



    Bret Pettichord <com> wrote in message news:<0.0.1>... 
    Paul Guest

  3. #3

    Default Re: Blocking Calls on Win32 Ruby


    "Bret Pettichord" <com> wrote in message 
    their 

    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)
     
    threads.

    At least the gets problem goes away on Cygwin.
     

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


    Shashank Guest

  4. #4

    Default Re: Blocking Calls on Win32 Ruby

    At 07:34 PM 2/17/2004, Shashank Date wrote: 

    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



    Bret Guest

  5. #5

    Default Re: Blocking Calls on Win32 Ruby

     

    Whoa ! That is a lot of code ...not sure if I can handle it ;-)
     

    Yes, cool !
     

    Unfortunately, yes.
     

    Take a look at win32-process 0.1.0 It provides fork() functionality, albeit
    with some limitations.
     
    the 
    run 

    My head hurts just by reading it !
     
    comparison.

    PyWin32 is very feature rich.

    -- shanko


    Shashank Guest

  6. #6

    Default Re: Blocking Calls on Win32 Ruby

    At 11:24 AM 2/22/2004, Shashank Date wrote: 
    >the 
    >run 
    >
    >My head hurts just by reading it ![/ref]

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



    _____________________________________
    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



    Bret Guest

  7. #7

    Default Re: Blocking Calls on Win32 Ruby


    "Bret Pettichord" <com> wrote in message 

    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?


    Shashank Guest

Similar Threads

  1. Replies: 1
    Last Post: February 12th, 12:37 PM
  2. Replies: 1
    Last Post: October 17th, 07:48 AM
  3. Timeouts for blocking calls
    By Steven Farlie in forum PHP Development
    Replies: 1
    Last Post: September 11th, 08:50 AM
  4. Multithreading and sockets blocking I/O on Win32
    By Dragos D in forum PERL Miscellaneous
    Replies: 3
    Last Post: August 18th, 02:23 PM
  5. pipe - non blocking read? (fork/Win32)
    By Stuart Moore in forum PERL Miscellaneous
    Replies: 6
    Last Post: July 7th, 03:53 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139