Overview
Comment: | Don't create unnecessary run loops. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
664e7d85cc8a9b7fd3146b8551c7bc71 |
User & Date: | js on 2012-09-17 06:43:07 |
Other Links: | manifest | tags |
Context
2012-09-17
| ||
06:58 | Pass the timer as argument in timer blocks. check-in: be7d619b6e user: js tags: trunk | |
06:43 | Don't create unnecessary run loops. check-in: 664e7d85cc user: js tags: trunk | |
06:38 | OFThread: Run the run loop if there is no main. check-in: ade50547f6 user: js tags: trunk | |
Changes
Modified src/OFThread.m from [8e90710066] to [e8774af2ab].
︙ | ︙ | |||
49 50 51 52 53 54 55 56 57 58 59 60 61 62 | #import "OFMutexUnlockFailedException.h" #import "OFNotImplementedException.h" #import "OFOutOfRangeException.h" #import "OFThreadJoinFailedException.h" #import "OFThreadStartFailedException.h" #import "OFThreadStillRunningException.h" #import "threading.h" static OFList *TLSKeys; static of_tlskey_t threadSelfKey; static OFThread *mainThread; static id | > | 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | #import "OFMutexUnlockFailedException.h" #import "OFNotImplementedException.h" #import "OFOutOfRangeException.h" #import "OFThreadJoinFailedException.h" #import "OFThreadStartFailedException.h" #import "OFThreadStillRunningException.h" #import "atomic.h" #import "threading.h" static OFList *TLSKeys; static of_tlskey_t threadSelfKey; static OFThread *mainThread; static id |
︙ | ︙ | |||
236 237 238 239 240 241 242 | mainThread->thread = of_thread_current(); if (!of_tlskey_set(threadSelfKey, mainThread)) @throw [OFInitializationFailedException exceptionWithClass: self]; } | | < < < < < < < < < < < < < < | | 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | mainThread->thread = of_thread_current(); if (!of_tlskey_set(threadSelfKey, mainThread)) @throw [OFInitializationFailedException exceptionWithClass: self]; } - initWithObject: (id)object_ { self = [super init]; object = [object_ retain]; return self; } #ifdef OF_HAVE_BLOCKS - initWithBlock: (of_thread_block_t)block_ { return [self initWithObject: nil block: block_]; } - initWithObject: (id)object_ block: (of_thread_block_t)block_ { self = [super init]; @try { object = [object_ retain]; block = [block_ copy]; } @catch (id e) { [self release]; @throw e; |
︙ | ︙ | |||
292 293 294 295 296 297 298 | [[OFRunLoop currentRunLoop] run]; return nil; } - (void)handleTermination { | | | | | 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 | [[OFRunLoop currentRunLoop] run]; return nil; } - (void)handleTermination { OFRunLoop *tmp = runLoop; runLoop = nil; [tmp release]; } - (void)start { if (running == OF_THREAD_RUNNING) @throw [OFThreadStillRunningException exceptionWithClass: [self class] |
︙ | ︙ | |||
335 336 337 338 339 340 341 342 343 344 345 346 347 348 | running = OF_THREAD_NOT_RUNNING; return returnValue; } - (OFRunLoop*)runLoop { return [[runLoop retain] autorelease]; } - (void)dealloc { if (running == OF_THREAD_RUNNING) @throw [OFThreadStillRunningException | > > > > > > > | 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 | running = OF_THREAD_NOT_RUNNING; return returnValue; } - (OFRunLoop*)runLoop { if (runLoop == nil) { OFRunLoop *tmp = [[OFRunLoop alloc] init]; if (!of_atomic_cmpswap_ptr((void**)&runLoop, nil, tmp)) [tmp release]; } return [[runLoop retain] autorelease]; } - (void)dealloc { if (running == OF_THREAD_RUNNING) @throw [OFThreadStillRunningException |
︙ | ︙ |