Skip to content

Instantly share code, notes, and snippets.

@loganwright
Created May 23, 2014 23:26
Show Gist options
  • Save loganwright/50750f8f7c26d7ee39dc to your computer and use it in GitHub Desktop.
Save loganwright/50750f8f7c26d7ee39dc to your computer and use it in GitHub Desktop.
//
// 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
//
// 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