On Sep 3, 2009, at 10:02 AM, erik quanstrom wrote:
in c, i don't see why such a bolt-on would be useful in
c, especially since your concurrent fifo would be limited
to one shared-memory node unless you're going to add a runtime
compiler.
It's primarily an aesthetic benefit. From
http://arstechnica.com/apple/reviews/2009/08/mac-os-x-10-6.ars/13
- (IBAction)analyzeDocument:(NSButton *)sender
{
NSDictionary *stats = [myDoc analyze];
[myModel setDict:stats];
[myStatsView setNeedsDisplay:YES];
[stats release];
}
becomes
- (IBAction)analyzeDocument:(NSButton *)sender
{
dispatch_async(dispatch_get_global_queue(0, 0), ^{
NSDictionary *stats = [myDoc analyze];
dispatch_async(dispatch_get_main_queue(), ^{
[myModel setDict:stats];
[myStatsView setNeedsDisplay:YES];
[stats release];
});
});
}
Two more lines of code, and it will execute that block in another
thread without having to do much thinking about it.
—
Daniel Lyons