Results 1 to 4 of 4

Thread: Ice/Ruby/Qt example

  1. #1
    Andreas Scherer is offline Registered User
    Name: Andreas Scherer
    Organization: Private Linux Site
    Project: Evaluating Ice-C++, Ice-Java, Ice-Python, Ice-Ruby
    Join Date
    Mar 2005
    Location
    Berlin, Germany
    Posts
    50

    Ice/Ruby/Qt example

    Cool! What a nice surprise at the end of the holidays.

    After looking at the demos shipped with IceRuby, I decided to push it somewhat further and came up with version 0.1 of QtClient.rb for the "hello" server. Please refer to the attached file for the code; details follow here.

    My configuration is OpenSUSE 10.0 with KDE 3.5.5 (kdebase3-3.5.5-17.1, qt3-3.3.6-185.1) and Ruby 1.8.2 (ruby-1.8.2-11.6). First I tried to upgrade to Ruby 1.8.5 as requested by IceRuby, but after I got hung up by kdebindings3-3.5.5-32.1, I decided to relax the requirements by patching config/Make.rules instead.

    When IceRuby compiled with Ruby 1.8.2, I modified the local environment appropriately by sourcing the shell file setupIceRuby. Then I merged code and ideas from the Qt/C++ "hello" client and the IceRuby console example, and came up with an initial version of QtClient.rb; this does not (yet) make use of a CallQueue as its C++ twin, but it seems to work just fine. Of course, comments are very much appreciated. Finally I changed the example config.client for the "linux" local host.

    Cheers
    Last edited by Andreas Scherer; 11-06-2006 at 03:13 PM.

  2. #2
    Andreas Scherer is offline Registered User
    Name: Andreas Scherer
    Organization: Private Linux Site
    Project: Evaluating Ice-C++, Ice-Java, Ice-Python, Ice-Ruby
    Join Date
    Mar 2005
    Location
    Berlin, Germany
    Posts
    50
    Can someone confirm that the CallQueue mechanism is currently not supportable in IceRubyQt? According to Richard Dale (http://lists.kde.org/?l=kde-bindings&m=112973788316454), Ruby threads can not be used in a QtRuby application (and IceUtil::Thread/Mutex are not available).

    Today I tried without success to make QtClient.rb responsive in case of long-running server events. However, as long as I do not join my callThread (aka playerThread or consumerThread) prior to qtapp.exec, the "Hello" button works synchronously. If I invoke callThread.join before qtapp.exec, the program aborts with a deadlock exception (presumably because the Queue runs empty?).

    Help and comments are welcome!

  3. #3
    mes's Avatar
    mes
    mes is offline ZeroC Staff
    Name: Mark Spruiell
    Organization: ZeroC, Inc.
    Project: Ice Developer
    Join Date
    Feb 2003
    Location
    California
    Posts
    1,441
    Hi Andreas,

    The Ruby interpreter is blocked for the duration of an Ice invocation. Since the interpreter uses only one native thread, this means that all Ruby threads are blocked until the invocation completes. If the Ruby interpreter ever supports native threads, I expect that we'll add support for asynchronous invocations. Until that time however, it would be difficult to address this limitation, and I doubt we would attempt it without someone to sponsor the effort.

    Take care,
    - Mark

  4. #4
    Andreas Scherer is offline Registered User
    Name: Andreas Scherer
    Organization: Private Linux Site
    Project: Evaluating Ice-C++, Ice-Java, Ice-Python, Ice-Ruby
    Join Date
    Mar 2005
    Location
    Berlin, Germany
    Posts
    50
    Thanks, Mark.

    It's not a pressing issue for me right now, so my initial QtClient.rb will have to stand as a nice proof-of-concept. Note that the updated attachment to my first submission now destroys the communicator; this part got thrown out with the surrounding CallQueue stuff.

    Greetings

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Ice ruby compilation
    By foohey in forum Help Center
    Replies: 0
    Last Post: 10-02-2010, 10:32 PM
  2. Ice for Ruby under Vista
    By PeteH in forum Help Center
    Replies: 5
    Last Post: 03-06-2007, 04:19 AM
  3. Ice with Qt 3
    By Andreas Scherer in forum Comments
    Replies: 0
    Last Post: 09-07-2006, 04:47 AM
  4. Ruby ICE binding
    By jrimmer in forum Comments
    Replies: 3
    Last Post: 04-08-2005, 08:32 PM
  5. ICE with Qt ?
    By mlo in forum Help Center
    Replies: 1
    Last Post: 06-22-2003, 09:33 AM

Posting Permissions

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