Re: [MacRuby-devel] Thread safety in apply example?

2011-01-24 Thread Alan Skipp
Warning, horrible hack alert! I'm sure there must be a far better implementation, but the idea is to have an array subclass which diverts all method calls through a serial dispatch queue, which should ensure thread safe access. Anyway, here's the horrible hack. By the way, it manages to break En

Re: [MacRuby-devel] Thread safety in apply example?

2011-01-24 Thread Matt Massicotte
What's the advantage of this over just iterating over the array serially using each? Matt On Jan 24, 2011, at 3:40 AM, Alan Skipp wrote: > Warning, horrible hack alert! > I'm sure there must be a far better implementation, but the idea is to have > an array subclass which diverts all method ca

Re: [MacRuby-devel] Thread safety in apply example?

2011-01-24 Thread Alan Skipp
The post was admittedly vague, but was more of an idea about a general purpose thread safe array class (in principle, this could apply to any mutable class). Perhaps implemented as a module that would redirect all method calls through a serial dispatch queue. This would mean that the array (or o

Re: [MacRuby-devel] Thread safety in apply example?

2011-01-24 Thread Matt Massicotte
My guess is that most problems need a thread-safe mechanism, where manipulating an array is just one part of a more complex system. Pushing the details of the thread-safety into the array just hides the problem, and will likely trade more locking for possibly simpler code. Which could be a ver

[MacRuby-devel] Unsubscribe

2011-01-24 Thread Robert Ash
eds to be updated. Anyone know better? >>> >>> -- Ernie P. >>> >>> >>>> >>>> - Charlie >>>> ___ >>>> MacRuby-devel mailing list >>>> MacRuby-devel@lists.maco

Re: [MacRuby-devel] Unsubscribe

2011-01-24 Thread Alan Skipp
e portion of memory, but >>>> doing a serial append: >>>> >>>> result << i*i >>>> >>>> would not. But that may have been a mistake on my part, since the size >>>> (at least) needs to be updated. Anyone know better?

[MacRuby-devel] Dispatch gem Re: Thread safety in apply example?

2011-01-24 Thread Ernest N. Prabhakar, Ph.D.
Hi all, On Jan 24, 2011, at 8:24 AM, Matt Massicotte wrote: > I'm just saying that achieving parallelism actually is hard. I've been much > better served (though, admittedly, not in Ruby) by trying to get really > familiar with the queue paradigm and understanding how to use them in place > o

Re: [MacRuby-devel] Concurrency bug in ControlTower

2011-01-24 Thread Joshua Ballanco
Hey Charles, Sure, this is as good a place as any to report issues on ControlTower. There's also a component for ControlTower on the MacRuby trac site, but I guess we don't really call that out on the web site. Regarding the potential bug...well...where to begin? So, yes, MacRuby blocks have the

Re: [MacRuby-devel] Thread safety in apply example?

2011-01-24 Thread Charles Oliver Nutter
On Mon, Jan 24, 2011 at 10:24 AM, Matt Massicotte wrote: > My guess is that most problems need a thread-safe mechanism, where > manipulating an array is just one part of a more complex system.  Pushing the > details of the thread-safety into the array just hides the problem, and will > likely t

Re: [MacRuby-devel] Thread safety in apply example?

2011-01-24 Thread Joshua Ballanco
On Sat, Jan 22, 2011 at 12:57 AM, Charles Oliver Nutter wrote: > I'm curious about this example in Queue#apply's rdoc: > > * gcdq = Dispatch::Queue.new('doc') > * @result = [] > * gcdq.apply(5) {|i| @result[i] = i*i } > * p @result #=> [0, 1, 4, 9, 16, 25] > > apply is said t

Re: [MacRuby-devel] Thread safety in apply example?

2011-01-24 Thread Joshua Ballanco
On Mon, Jan 24, 2011 at 12:15 PM, Charles Oliver Nutter wrote: > Queue#apply is actually defined in gcd.c in MacRuby's code, so this > would be a MacRuby bug. I'd have filed it, but I wasn't sure if I was > missing something about MacRuby's Array and thread-safety. Yeah, probably a documentatio

Re: [MacRuby-devel] Thread safety in apply example?

2011-01-24 Thread Jordan K. Hubbard
On Jan 24, 2011, at 8:00 AM, Alan Skipp wrote: > The post was admittedly vague, but was more of an idea about a general > purpose thread safe array class (in principle, this could apply to any > mutable class). Perhaps implemented as a module that would redirect all > method calls through a se

Re: [MacRuby-devel] Thread safety in apply example?

2011-01-24 Thread Charles Oliver Nutter
On Mon, Jan 24, 2011 at 11:26 AM, Joshua Ballanco wrote: > On Mon, Jan 24, 2011 at 12:15 PM, Charles Oliver Nutter > wrote: >> >> Queue#apply is actually defined in gcd.c in MacRuby's code, so this >> would be a MacRuby bug. I'd have filed it, but I wasn't sure if I was >> missing something about

Re: [MacRuby-devel] Thread safety in apply example?

2011-01-24 Thread Charles Oliver Nutter
On Mon, Jan 24, 2011 at 11:39 AM, Jordan K. Hubbard wrote: > FWIW, we've tried this same approach experimentally (use a per-object serial > queue behind the scenes to implement an async setter / sync getter model) > over in CoreFoundation land, and it seemed to work reasonably well for the > mo

Re: [MacRuby-devel] Thread safety in apply example?

2011-01-24 Thread Charles Oliver Nutter
On Mon, Jan 24, 2011 at 11:23 AM, Joshua Ballanco wrote: > Arrays in MacRuby are not inherently thread safe. However, > "Dispatch::Queue.new" creates a serial queue. So, there is an error in that > each invocation of the block will execute serially. If, instead, the example > had used "Dispatch::Q

[MacRuby-devel] MacDriverLog Installer

2011-01-24 Thread Robert Rice
Hi MacRubyists: MacDriverLog is an application I am developing for truckers using MacRuby. I can't fully test the installer without a second machine. I would appreciate it if someone could download it from http://MacDriverLog.com and let me know if the install package works. Thanks, Bob Rice

Re: [MacRuby-devel] Thread safety in apply example?

2011-01-24 Thread Joshua Ballanco
On Mon, Jan 24, 2011 at 8:20 PM, Charles Oliver Nutter wrote: > Yes, forcing the updates to run serially rather than in parallel. The > poor-man's fork/join. More like a map-reduce, I would think. In fact, at some point in the past the "dispatch extras" (i.e. everything in MacRuby dispatch relat