Ruby interpreter thread safety

Ask a Question related to Ruby, Design and Development.

  1. #1

    Default Ruby interpreter thread safety

    I have a scenario where a ruby extension module starts real/os/heavy-weight
    threads that may call back to ruby. As far as I understand the ruby
    interpreter itself is not thread safe. How can I handle this thread-safety
    problem?

    Cheers,

    Thomas


    Thomas Sondergaard Guest

  2. Similar Questions and Discussions

    1. Thread safety/synchronization?
      Flex/AS doesn't appear to have any overt synchronization mechanism, is it handled under the covers (ie is every method synchronized?) or is it user...
    2. apartmant thread safety
      I'm rather confused about this whole threading business of IIS, ASP and COM components. We have an apartment threaded component with a function...
    3. Trying to figure out thread safety
      (Having been told of a solution to one problem (File::CREAT was indeed what was needed), I'll now go off on something entirely different.) I've...
    4. Thread safety: Serializing access to ruby interpreter- again
      I recently asked about this and got answers, but here I go again: How can I efficiently serialize access to the ruby interpreter. I have to make...
    5. Thread safety of vm_copy
      I tried looking around for explicit documentation on this but to no avail, perhaps it is too basic. On Mac OS X the Mach function vm_copy has a...
  3. #2

    Default Re: Ruby interpreter thread safety

    Hi,

    At Thu, 4 Sep 2003 19:45:24 +0900,
    Thomas Sondergaard wrote:
    > I have a scenario where a ruby extension module starts real/os/heavy-weight
    > threads that may call back to ruby. As far as I understand the ruby
    > interpreter itself is not thread safe. How can I handle this thread-safety
    > problem?
    Run the ruby interpreter in a particular os-thread, and use
    system provided queue.

    --
    Nobu Nakada

    nobu.nokada@softhome.net Guest

  4. #3

    Default Re: Ruby interpreter thread safety

    On Thu, 2003-09-04 at 06:45, Thomas Sondergaard wrote:
    > I have a scenario where a ruby extension module starts real/os/heavy-weight
    > threads that may call back to ruby. As far as I understand the ruby
    > interpreter itself is not thread safe. How can I handle this thread-safety
    > problem?
    The general solution for any threaded code making calls to a non-thread
    safe library is to do one of the following:

    (a) Make calls into the library (callbacks in your case) from
    only a single thread.
    or (b) Serialize calls to the library by using a mutex of some type.

    --
    -- Jim Weirich [email]jweirich@one.net[/email] [url]http://onestepback.org[/url]
    -----------------------------------------------------------------
    "Beware of bugs in the above code; I have only proved it correct,
    not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)

    Jim Weirich Guest

  5. #4

    Default Re: Ruby interpreter thread safety

    > The general solution for any threaded code making calls to a non-thread
    > safe library is to do one of the following:
    >
    > (a) Make calls into the library (callbacks in your case) from
    > only a single thread.
    > or (b) Serialize calls to the library by using a mutex of some type.
    Got it!

    Thomas


    Thomas Sondergaard Guest

  6. #5

    Default Re: Ruby interpreter thread safety

    > Run the ruby interpreter in a particular os-thread, and use
    > system provided queue.
    Could you give me an example of such a system provided queue?

    Cheers,

    Thomas


    Thomas Sondergaard Guest

Posting Permissions

  • You may not post new threads
  • You may 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