• This repository has been archived on 01/Jul/2020
  • Stars
    star
    101
  • Rank 338,166 (Top 7 %)
  • Language
    Objective-C
  • License
    MIT License
  • Created over 11 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Objective-C wrapper for Grand Central Dispatch

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

  • 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.

More Repositories

1

KeepLayout

Making Auto Layout easier to code.
Objective-C
836
star
2

Block-KVO

Objective-C Key-Value Observing made easier with blocks
Objective-C
398
star
3

Objective-Chain

Object-oriented reactive framework, inspired by ReactiveCocoa
Objective-C
237
star
4

UIView-AnimatedProperty

Extending `UIView` block animations to allow you to implement custom animated properties.
Objective-C
158
star
5

Typed

Brings type inference to Objective-C with almost no hacks.
Objective-C
86
star
6

ITNDescription

Automatic and smart -debugDescription for every Objective-C class.
Objective-C
33
star
7

GrandSwiftDispatch

Not so Grand, not so Swift, and not so Dispatch
Swift
28
star
8

Valid-KeyPath

Allows you to specify Objective-C key-paths using symbols taking all advantages – code-completion, complite-time validation, refactoring.
Objective-C
25
star
9

Essentials

Collection of categories, functions, macros and classes that are essential part of my projects.
Objective-C
18
star
10

MTKButtonState

Allows you to set UIButton state-based properties with dot syntax.
Objective-C
17
star
11

NSObject-GCD

NSObject+GCD: Category on NSObject with methods that wrap some of the GCD functions.
Objective-C
12
star
12

TetrisEngine

Core of a simple Tetris game with no UI
Swift
12
star
13

Where

Locate the user of the current iOS device without CoreLocation.
Objective-C
10
star
14

Yield

Support for multiple entry points and return values in Objective-C.
Objective-C
7
star
15

GEOCoordinateFormatter

NSFormatter for geographic coordinates
Swift
6
star
16

jDateFormat

Never again write date formats by hand. YYYY anyone?
C
4
star
17

LinearKit

Objective-C wrapper for Accelerate framework.
Objective-C
4
star
18

SwiftToolbox

Collection of additions to Swift that I use in every project.
Swift
4
star
19

Adoption

OS X Today Widget to show iOS 9 adoption.
Swift
4
star
20

JSONArchiver

NSCoder that produces JSON object archives, replacement for NSKeyedArchiver.
Objective-C
3
star
21

RichArchiver

Archivation tool for `NSAttributedStrings` for cross-platform exchange – OS X to iOS
Objective-C
3
star
22

CSVBuilder

Swift class that builds CSV files from provided cell data.
Swift
2
star
23

iOS-Toolbox

Open-source app with a collection of tools for iOS devs.
Objective-C
2
star
24

YAML

Attempt to use YAML conveniently from Swift and Objective-C.
Swift
2
star
25

MTKResource

Dealing with iOS devices, screen sizes, languages and extensions.
Objective-C
1
star
26

Objective-R

Not a language.
1
star
27

Geocoder

Geocoding app quickly built with Swift as a tool to inspect address formats around the world.
Swift
1
star
28

Fractioning

Convert decimal numbers to fractions.
Objective-C
1
star
29

SQL-Model

Objective-C modeling library that generates SQL statements.
Objective-C
1
star
30

TRITableModel

Collections modeled to be suitable as UITableView data source.
Objective-C
1
star