Home

Awesome

Grand Object Dispatch

Objective-C wrapper for Grand Central Dispatch with method for every single dispatch call and with some useful additions.

Contribution in form of Pull Requests, Feature Requests or Issues is welcome! Especially suggesing improved API for Dispatch Sources, Dispatch IO and Dispatch Data would be really appreciated.

Additions

Example Code

Grand Object Dispatch

GODQueue *clusterQueue = [[GODQueue alloc] initWithName:@"cluster" concurrent:YES];
GODQueue *isolationQueue = [[GODQueue alloc] initWithName:@"isolation" concurrent:YES];

[clusterQueue apply:100 block:^(NSUInteger index) {
    [isolationQueue sync:^{
        // access shared resource
    }];
    
    // iterative calculation
    
    [isolationQueue barrierAsync:^{
        // modify shared resource
    }];
}];

[clusterQueue barrierAsync:^{
    
    // finalize data
    
    [[GODQueue mainQueue] async:^{
        // update UI
    }];
}];

Grand Central Dispatch

dispatch_queue_t clusterQueue = dispatch_queue_create("cluster", DISPATCH_QUEUE_CONCURRENT);
dispatch_queue_t isolationQueue = dispatch_queue_create("isolation", DISPATCH_QUEUE_CONCURRENT);

dispatch_apply(100, clusterQueue, ^(size_t index) {
    dispatch_sync(isolationQueue, ^{
        // access shared resource
    });
    
    // iterative calculation
    
    dispatch_barrier_async(isolationQueue, ^{
        // modify shared resource
    });
});

dispatch_barrier_async(clusterQueue, ^{
    
    // finalize data
    
    dispatch_async(dispatch_get_main_queue(), ^{
        // update UI
    });
});

Implemented (or not yet)


Version 0.5.0

MIT License, Copyright © 2013 Martin Kiss

THE SOFTWARE IS PROVIDED "AS IS", and so on... see LICENSE.md for more.