From: Robert Klemme Date: 2013-04-09T23:04:29+09:00 Subject: Re: Mapping string data ptr to buffer in ffi --00235446ffec0acf4e04d9ee08a5 Content-Type: text/plain; charset=ISO-8859-1 On Tue, Apr 9, 2013 at 11:10 AM, se gm wrote: > >although he never explicitly > >stated whether resizing would be necessary. > Resizing in my case is not necessary. Many fragments may be mapped into > one or more huge strings which are not changed from Ruby environment > (they are just preallocated). > >and apparently also without proper synchronization. > That is totally wrong. If it is syncronized for the particular situation > then one can call it "right", and the language concepts would be > irrelevant. The actual syncronization is the only thing that matters. > Well, Ruby's String certainly has no synchronizations built in with the library you want to integrate so how will you ensure that there is proper synchronization? So far I have only seen that you want to share the memory of a Ruby string's byte array with some third party library which will then write to the memory from threads not controlled by Ruby. You said you need "only one blocking syncronization call from Ruby to start working with the string" - but what do you do afterwards, i.e. while the processing is under way and "the string changes should be immediately visible in Ruby"? Cheers robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/ --00235446ffec0acf4e04d9ee08a5 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable


--00235446ffec0acf4e04d9ee08a5--