171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
|
+ (instancetype)thread
{
return [[[self alloc] init] autorelease];
}
# ifdef OF_HAVE_BLOCKS
+ (instancetype)threadWithThreadBlock: (of_thread_block_t)threadBlock
{
return [[[self alloc] initWithThreadBlock: threadBlock] autorelease];
}
# endif
+ (OFThread *)currentThread
{
|
|
|
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
|
+ (instancetype)thread
{
return [[[self alloc] init] autorelease];
}
# ifdef OF_HAVE_BLOCKS
+ (instancetype)threadWithThreadBlock: (OFThreadBlock)threadBlock
{
return [[[self alloc] initWithThreadBlock: threadBlock] autorelease];
}
# endif
+ (OFThread *)currentThread
{
|
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
|
DNSResolver = [[OFDNSResolver alloc] init];
return DNSResolver;
# endif
}
#endif
+ (void)sleepForTimeInterval: (of_time_interval_t)timeInterval
{
if (timeInterval < 0)
return;
#if defined(OF_WINDOWS)
if (timeInterval * 1000 > UINT_MAX)
@throw [OFOutOfRangeException exception];
|
|
|
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
|
DNSResolver = [[OFDNSResolver alloc] init];
return DNSResolver;
# endif
}
#endif
+ (void)sleepForTimeInterval: (OFTimeInterval)timeInterval
{
if (timeInterval < 0)
return;
#if defined(OF_WINDOWS)
if (timeInterval * 1000 > UINT_MAX)
@throw [OFOutOfRangeException exception];
|
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
|
@throw e;
}
return self;
}
# ifdef OF_HAVE_BLOCKS
- (instancetype)initWithThreadBlock: (of_thread_block_t)threadBlock
{
self = [self init];
@try {
_threadBlock = [threadBlock copy];
} @catch (id e) {
[self release];
|
|
|
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
|
@throw e;
}
return self;
}
# ifdef OF_HAVE_BLOCKS
- (instancetype)initWithThreadBlock: (OFThreadBlock)threadBlock
{
self = [self init];
@try {
_threadBlock = [threadBlock copy];
} @catch (id e) {
[self release];
|