Berger, Daniel
2006-Oct-13 19:00 UTC
[Win32utils-devel] win32-mmap - trying to marshal self
Hi all, I realized the current implmentation has a problem - you can only get the last value set? I realized, after looking at the old C code, that it actually stores values in a hash and marshals the hash, not the values themselves. That seemed clunky to me, though. I thought it would be more interesting if we just marshalled the entire mmap object and passed that back and forth. Unfortunately, it doesn''t seem to work. For the getter in method_missing I simply did: marshal = Marshal.dump(self) For the getter in method_missing I did: obj = memcpy(buf, @address, @size) val = object.send(obj.to_sym) instance_variable_set("@#{method}", Marshal.load(val)) But when I run the map1.rb and map2.rb scripts again, I get errors (and beeping!) with odd characters no less: C:/Documents and Settings/djberge/workspace/win32-mmap/lib/win32/mmap.rb:334:in `send'': undefined method o:?Win32::MMap? @inheriti'' for nil:NilClass (NoMethodError) from C:/Documents and Settings/djberge/workspace/win32-mmap/lib/win32/mmap.rb:334:in `method_missing'' from map2.rb:8 Is this because of the Semaphore? If we can''t marshal self, that''s fine, I''ll just resort to the hash strategy, but I thought I would ask. Thanks, Dan This communication is the property of Qwest and may contain confidential or privileged information. Unauthorized use of this communication is strictly prohibited and may be unlawful. If you have received this communication in error, please immediately notify the sender by reply e-mail and destroy all copies of the communication and any attachments.
Daniel Berger
2006-Oct-14 01:03 UTC
[Win32utils-devel] win32-mmap - trying to marshal self
On 10/13/06, Berger, Daniel <Daniel.Berger at qwest.com> wrote:> > Hi all, > > I realized the current implmentation has a problem - you can only get the > last value set? I realized, after looking at the old C code, that it > actually stores values in a hash and marshals the hash, not the values > themselves. > > That seemed clunky to me, though. I thought it would be more interesting > if we just marshalled the entire mmap object and passed that back and > forth. Unfortunately, it doesn''t seem to work.<snip> Ah, nevermind. I''ll just pass a hash back and forth for now. I want to get something released this weekend so that folks get a chance to play with it in time for RubyConf. BTW, anyone on the list going to be at RubyConf? - Dan -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/win32utils-devel/attachments/20061013/a114414f/attachment.html
Wayne Vucenic
2006-Oct-14 06:05 UTC
[Win32utils-devel] win32-mmap - trying to marshal self
Hi Dan,> BTW, anyone on the list going to be at RubyConf?I enjoyed meeting you at RubyConf last year. See you in Denver! Wayne On 10/13/06, Daniel Berger <djberg96 at gmail.com> wrote:> > > On 10/13/06, Berger, Daniel <Daniel.Berger at qwest.com> wrote: > > Hi all, > > > > I realized the current implmentation has a problem - you can only get the > last value set? I realized, after looking at the old C code, that it > actually stores values in a hash and marshals the hash, not the values > themselves. > > > > That seemed clunky to me, though. I thought it would be more interesting > if we just marshalled the entire mmap object and passed that back and forth. > Unfortunately, it doesn''t seem to work. > > <snip> > > Ah, nevermind. I''ll just pass a hash back and forth for now. I want to get > something released this weekend so that folks get a chance to play with it > in time for RubyConf. > > BTW, anyone on the list going to be at RubyConf? > > - Dan > > > > _______________________________________________ > win32utils-devel mailing list > win32utils-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/win32utils-devel > >