/* NSOperation.h
Copyright (c) 2006-2015, Apple Inc. All rights reserved.
*/
#import <Foundation/NSObject.h>
#import <sys/qos.h>
#import <dispatch/dispatch.h>
@class NSArray<ObjectType>, NSSet;
NS_ASSUME_NONNULL_BEGIN
#define NSOperationQualityOfService NSQualityOfService
#define NSOperationQualityOfServiceUserInteractive NSQualityOfServiceUserInteractive
#define NSOperationQualityOfServiceUserInitiated NSQualityOfServiceUserInitiated
#define NSOperationQualityOfServiceUtility NSQualityOfServiceUtility
#define NSOperationQualityOfServiceBackground NSQualityOfServiceBackground
NS_CLASS_AVAILABLE(10_5, 2_0)
@interface NSOperation : NSObject {
@private
id _private;
int32_t _private1;
#if __LP64__
int32_t _private1b;
#endif
}
- (void)start;
- (void)main;
@property (readonly, getter=isCancelled) BOOL cancelled;
- (void)cancel;
@property (readonly, getter=isExecuting) BOOL executing;
@property (readonly, getter=isFinished) BOOL finished;
@property (readonly, getter=isConcurrent) BOOL concurrent; // To be deprecated; use and override 'asynchronous' below
@property (readonly, getter=isAsynchronous) BOOL asynchronous NS_AVAILABLE(10_8, 7_0);
@property (readonly, getter=isReady) BOOL ready;
- (void)addDependency:(NSOperation *)op;
- (void)removeDependency:(NSOperation *)op;
@property (readonly, copy) NSArray<NSOperation *> *dependencies;
typedef NS_ENUM(NSInteger, NSOperationQueuePriority) {
NSOperationQueuePriorityVeryLow = -8L,
NSOperationQueuePriorityLow = -4L,
NSOperationQueuePriorityNormal = 0,
NSOperationQueuePriorityHigh = 4,
NSOperationQueuePriorityVeryHigh = 8
};
@property NSOperationQueuePriority queuePriority;
@property (nullable, copy) void (^completionBlock)(void) NS_AVAILABLE(10_6, 4_0);
- (void)waitUntilFinished NS_AVAILABLE(10_6, 4_0);
@property double threadPriority NS_DEPRECATED(10_6, 10_10, 4_0, 8_0);
@property NSQualityOfService qualityOfService NS_AVAILABLE(10_10, 8_0);
@property (nullable, copy) NSString *name NS_AVAILABLE(10_10, 8_0);
@end
NS_CLASS_AVAILABLE(10_6, 4_0)
@interface NSBlockOperation : NSOperation {
@private
id _private2;
void *_reserved2;
}
+ (instancetype)blockOperationWithBlock:(void (^)(void))block;
- (void)addExecutionBlock:(void (^)(void))block;
@property (readonly, copy) NSArray<void (^)(void)> *executionBlocks;
@end
NS_CLASS_AVAILABLE(10_5, 2_0)
NS_SWIFT_UNAVAILABLE("NSInvocation and related APIs not available")
@interface NSInvocationOperation : NSOperation {
@private
id _inv;
id _exception;
void *_reserved2;
}
- (nullable instancetype)initWithTarget:(id)target selector:(SEL)sel object:(nullable id)arg;
- (instancetype)initWithInvocation:(NSInvocation *)inv NS_DESIGNATED_INITIALIZER;
@property (readonly, retain) NSInvocation *invocation;
@property (nullable, readonly, retain) id result;
@end
FOUNDATION_EXPORT NSString * const NSInvocationOperationVoidResultException NS_AVAILABLE(10_5, 2_0);
FOUNDATION_EXPORT NSString * const NSInvocationOperationCancelledException NS_AVAILABLE(10_5, 2_0);
static const NSInteger NSOperationQueueDefaultMaxConcurrentOperationCount = -1;
NS_CLASS_AVAILABLE(10_5, 2_0)
@interface NSOperationQueue : NSObject {
@private
id _private;
void *_reserved;
}
- (void)addOperation:(NSOperation *)op;
- (void)addOperations:(NSArray<NSOperation *> *)ops waitUntilFinished:(BOOL)wait NS_AVAILABLE(10_6, 4_0);
- (void)addOperationWithBlock:(void (^)(void))block NS_AVAILABLE(10_6, 4_0);
@property (readonly, copy) NSArray<__kindof NSOperation *> *operations;
@property (readonly) NSUInteger operationCount NS_AVAILABLE(10_6, 4_0);
@property NSInteger maxConcurrentOperationCount;
@property (getter=isSuspended) BOOL suspended;
@property (nullable, copy) NSString *name NS_AVAILABLE(10_6, 4_0);
@property NSQualityOfService qualityOfService NS_AVAILABLE(10_10, 8_0);
@property (nullable, assign /* actually retain */) dispatch_queue_t underlyingQueue NS_AVAILABLE(10_10, 8_0);
- (void)cancelAllOperations;
- (void)waitUntilAllOperationsAreFinished;
+ (nullable NSOperationQueue *)currentQueue NS_AVAILABLE(10_6, 4_0);
+ (NSOperationQueue *)mainQueue NS_AVAILABLE(10_6, 4_0);
@end
NS_ASSUME_NONNULL_END
NSOperation.h
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
- 文/潘曉璐 我一進(jìn)店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來(lái),“玉大人卿城,你說(shuō)我怎么就攤上這事枚钓。” “怎么了瑟押?”我有些...
- 文/不壞的土叔 我叫張陵搀捷,是天一觀的道長(zhǎng)。 經(jīng)常有香客問我多望,道長(zhǎng)嫩舟,這世上最難降的妖魔是什么? 我笑而不...
- 正文 為了忘掉前任怀偷,我火速辦了婚禮家厌,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘椎工。我一直安慰自己饭于,他們只是感情好,可當(dāng)我...
- 文/花漫 我一把揭開白布维蒙。 她就那樣靜靜地躺著掰吕,像睡著了一般。 火紅的嫁衣襯著肌膚如雪颅痊。 梳的紋絲不亂的頭發(fā)上殖熟,一...
- 那天,我揣著相機(jī)與錄音斑响,去河邊找鬼吗讶。 笑死,一個(gè)胖子當(dāng)著我的面吹牛恋捆,可吹牛的內(nèi)容都是我干的照皆。 我是一名探鬼主播,決...
- 文/蒼蘭香墨 我猛地睜開眼沸停,長(zhǎng)吁一口氣:“原來(lái)是場(chǎng)噩夢(mèng)啊……” “哼膜毁!你這毒婦竟也來(lái)了?” 一聲冷哼從身側(cè)響起愤钾,我...
- 序言:老撾萬(wàn)榮一對(duì)情侶失蹤瘟滨,失蹤者是張志新(化名)和其女友劉穎,沒想到半個(gè)月后能颁,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體杂瘸,經(jīng)...
- 正文 獨(dú)居荒郊野嶺守林人離奇死亡,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
- 正文 我和宋清朗相戀三年伙菊,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了败玉。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片敌土。...
- 正文 年R本政府宣布矩欠,位于F島的核電站,受9級(jí)特大地震影響悠夯,放射性物質(zhì)發(fā)生泄漏癌淮。R本人自食惡果不足惜,卻給世界環(huán)境...
- 文/蒙蒙 一沦补、第九天 我趴在偏房一處隱蔽的房頂上張望该默。 院中可真熱鬧,春花似錦策彤、人聲如沸栓袖。這莊子的主人今日做“春日...
- 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)裹刮。三九已至,卻和暖如春庞瘸,著一層夾襖步出監(jiān)牢的瞬間捧弃,已是汗流浹背。 一陣腳步聲響...
- 正文 我出身青樓瞬场,卻偏偏與公主長(zhǎng)得像买鸽,于是被迫代替她去往敵國(guó)和親。 傳聞我的和親對(duì)象是個(gè)殘疾皇子贯被,可洞房花燭夜當(dāng)晚...
推薦閱讀更多精彩內(nèi)容
- 這個(gè)文章是依照 WWDC 2015 Advanced NSOperations 而來(lái)的眼五,主要講解Operation...
- NSOperation NSOperation的作用 配合使用NSOperation和NSOperationQue...
- 秋雨生閑愁,愛上層樓彤灶。想去四樓的陽(yáng)臺(tái)看看雨中即景看幼。在四樓陽(yáng)臺(tái)的拐角,我的目光怔怔與斜靠在那里的一桿秤不期而...