27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
OF_DIRECT_MEMBERS
@interface OFThreadPoolJob: OFObject
{
id _target;
SEL _selector;
id _object;
#ifdef OF_HAVE_BLOCKS
of_thread_pool_block_t _block;
#endif
}
- (instancetype)initWithTarget: (id)target
selector: (SEL)selector
object: (id)object;
#ifdef OF_HAVE_BLOCKS
- (instancetype)initWithBlock: (of_thread_pool_block_t)block;
#endif
- (void)perform;
@end
@implementation OFThreadPoolJob
- (instancetype)initWithTarget: (id)target
selector: (SEL)selector
|
|
|
|
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
OF_DIRECT_MEMBERS
@interface OFThreadPoolJob: OFObject
{
id _target;
SEL _selector;
id _object;
#ifdef OF_HAVE_BLOCKS
OFThreadPoolBlock _block;
#endif
}
- (instancetype)initWithTarget: (id)target
selector: (SEL)selector
object: (id)object;
#ifdef OF_HAVE_BLOCKS
- (instancetype)initWithBlock: (OFThreadPoolBlock)block;
#endif
- (void)perform;
@end
@implementation OFThreadPoolJob
- (instancetype)initWithTarget: (id)target
selector: (SEL)selector
|
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
@throw e;
}
return self;
}
#ifdef OF_HAVE_BLOCKS
- (instancetype)initWithBlock: (of_thread_pool_block_t)block
{
self = [super init];
@try {
_block = [block copy];
} @catch (id e) {
[self release];
|
|
|
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
@throw e;
}
return self;
}
#ifdef OF_HAVE_BLOCKS
- (instancetype)initWithBlock: (OFThreadPoolBlock)block
{
self = [super init];
@try {
_block = [block copy];
} @catch (id e) {
[self release];
|
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
|
[self of_dispatchJob: job];
} @finally {
[job release];
}
}
#ifdef OF_HAVE_BLOCKS
- (void)dispatchWithBlock: (of_thread_pool_block_t)block
{
OFThreadPoolJob *job = [[OFThreadPoolJob alloc] initWithBlock: block];
@try {
[self of_dispatchJob: job];
} @finally {
[job release];
}
|
|
|
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
|
[self of_dispatchJob: job];
} @finally {
[job release];
}
}
#ifdef OF_HAVE_BLOCKS
- (void)dispatchWithBlock: (OFThreadPoolBlock)block
{
OFThreadPoolJob *job = [[OFThreadPoolJob alloc] initWithBlock: block];
@try {
[self of_dispatchJob: job];
} @finally {
[job release];
}
|