Latest 0.5.0
Homepage https://github.com/iMartinKiss/Grand-Object-Dispatch
License MIT
Platforms ios 6.0, requires ARC
Authors

Grand Object Dispatch Flattr this

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

  • Detection of Current Queue using dispatch_get_specific.
  • Deadlock-safe -sync: method.
  • Convenience initializer for reverse-DNS label.
  • Accessors for Main Queue and Global Concurrent Queues.
  • Method -log: which is replacement for deprecated dispatch_debug.
  • Better macro for dispatch_once.
  • Waiting methods for Semaphores and Groups taking time interval or date or waiting forever.
  • Specific class for Dispatch Timer (Dispatch Source of type Timer).

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.

Latest podspec

{
    "name": "GrandObjectDispatch",
    "version": "0.5.0",
    "summary": "Objective-C wrapper for Grand Central Dispatch.",
    "homepage": "https://github.com/iMartinKiss/Grand-Object-Dispatch",
    "authors": {
        "Martin Kiss": "[email protected]"
    },
    "license": "MIT",
    "source": {
        "git": "https://github.com/iMartinKiss/Grand-Object-Dispatch.git",
        "tag": "v0.5.0"
    },
    "platforms": {
        "ios": "6.0"
    },
    "source_files": "Sources",
    "public_header_files": "GrandObjectDispatch.h",
    "requires_arc": true
}

Pin It on Pinterest

Share This