Differences From Artifact [cbd29f4328]:
- File src/OFThread.m — part of check-in [aa0384d1bf] at 2018-07-28 18:45:36 on branch trunk — Rename OFLocalization -> OFLocale (user: js, size: 9203) [annotate] [blame] [check-ins using]
To Artifact [0be3da0cb6]:
- File
src/OFThread.m
— part of check-in
[2fb0769744]
at
2018-08-11 20:25:04
on branch trunk
— Add +[OFThread DNSResolver]
This returns the DNS resolver for the current thread. (user: js, size: 9765) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
48 49 50 51 52 53 54 | #import "OFThread.h" #import "OFThread+Private.h" #import "OFAutoreleasePool+Private.h" #import "OFAutoreleasePool.h" #import "OFDate.h" #import "OFDictionary.h" | > | > | 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | #import "OFThread.h" #import "OFThread+Private.h" #import "OFAutoreleasePool+Private.h" #import "OFAutoreleasePool.h" #import "OFDate.h" #import "OFDictionary.h" #ifdef OF_HAVE_SOCKETS # import "OFDNSResolver.h" #endif #import "OFLocale.h" #import "OFRunLoop.h" #import "OFString.h" #ifdef OF_WINDOWS # include <windows.h> #endif |
︙ | ︙ | |||
126 127 128 129 130 131 132 133 134 135 136 137 138 139 | thread->_running = OF_THREAD_WAITING_FOR_JOIN; objc_autoreleasePoolPop(thread->_pool); [OFAutoreleasePool of_handleThreadTermination]; [thread release]; } #endif @implementation OFThread #ifdef OF_HAVE_THREADS @synthesize name = _name; # ifdef OF_HAVE_BLOCKS @synthesize threadBlock = _threadBlock; | > > | 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | thread->_running = OF_THREAD_WAITING_FOR_JOIN; objc_autoreleasePoolPop(thread->_pool); [OFAutoreleasePool of_handleThreadTermination]; [thread release]; } #else static OFDNSResolver *DNSResolver; #endif @implementation OFThread #ifdef OF_HAVE_THREADS @synthesize name = _name; # ifdef OF_HAVE_BLOCKS @synthesize threadBlock = _threadBlock; |
︙ | ︙ | |||
180 181 182 183 184 185 186 187 188 189 190 191 192 193 | if (thread->_threadDictionary == nil) thread->_threadDictionary = [[OFMutableDictionary alloc] init]; return thread->_threadDictionary; } #endif + (void)sleepForTimeInterval: (of_time_interval_t)timeInterval { if (timeInterval < 0) return; #if defined(OF_WINDOWS) | > > > > > > > > > > > > > > > > > > > > > > | 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | if (thread->_threadDictionary == nil) thread->_threadDictionary = [[OFMutableDictionary alloc] init]; return thread->_threadDictionary; } #endif #ifdef OF_HAVE_SOCKETS + (OFDNSResolver *)DNSResolver { # ifdef OF_HAVE_THREADS OFThread *thread = of_tlskey_get(threadSelfKey); if (thread == nil) return nil; if (thread->_DNSResolver == nil) thread->_DNSResolver = [[OFDNSResolver alloc] init]; return thread->_DNSResolver; # else if (DNSResolver == nil) DNSResolver = [[OFDNSResolver alloc] init]; return DNSResolver; # endif } #endif + (void)sleepForTimeInterval: (of_time_interval_t)timeInterval { if (timeInterval < 0) return; #if defined(OF_WINDOWS) |
︙ | ︙ | |||
350 351 352 353 354 355 356 357 358 359 360 361 362 363 | { OFRunLoop *oldRunLoop = _runLoop; _runLoop = nil; [oldRunLoop release]; [_threadDictionary release]; _threadDictionary = nil; } - (void)start { if (_running == OF_THREAD_RUNNING) @throw [OFThreadStillRunningException exceptionWithThread: self]; | > > > > > | 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 | { OFRunLoop *oldRunLoop = _runLoop; _runLoop = nil; [oldRunLoop release]; [_threadDictionary release]; _threadDictionary = nil; # ifdef OF_HAVE_SOCKETS [_DNSResolver release]; _DNSResolver = nil; # endif } - (void)start { if (_running == OF_THREAD_RUNNING) @throw [OFThreadStillRunningException exceptionWithThread: self]; |
︙ | ︙ |