Created
May 23, 2014 23:26
-
-
Save loganwright/50750f8f7c26d7ee39dc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// NSNonConcurrentOperation.h | |
// ConcurrencyPractice | |
// | |
// Created by Logan Wright on 5/23/14. | |
// Copyright (c) 2014 Logan Wright. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> | |
@interface NSNonConcurrentOperation : NSOperation | |
@property (strong, nonatomic) id myData; | |
-(id)initWithData:(id)data; | |
@end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// NSNonConcurrentOperation.m | |
// ConcurrencyPractice | |
// | |
// Created by Logan Wright on 5/23/14. | |
// Copyright (c) 2014 Logan Wright. All rights reserved. | |
// | |
#import "NSNonConcurrentOperation.h" | |
@implementation NSNonConcurrentOperation | |
- (id)initWithData:(id)data { | |
if (self = [super init]) { | |
_myData = data; | |
} | |
return self; | |
} | |
-(void)main { | |
@try { | |
// Do some work on myData and report the results. | |
} | |
@catch(...) { | |
// Do not rethrow exceptions. | |
} | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment