Differences From Artifact [46e892e905]:
- File
src/OFStreamObserver.m
— part of check-in
[417b213d41]
at
2012-07-16 23:49:50
on branch trunk
— Add OF_ENSURE.
This is to be used when the condition includes a statement that needs to
be executed, as with assert, this would not be executed anymore when
NDEBUG is defined. (user: js, size: 8879) [annotate] [blame] [check-ins using]
To Artifact [44b77ee334]:
- File
src/OFStreamObserver.m
— part of check-in
[1255f3a11a]
at
2012-08-10 20:08:24
on branch trunk
— Directly use the runtime's autorelease pools.
This greatly improves performance, as it gets rid of the overhead of
OFAutoreleasePool. (user: js, size: 8840) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
28 29 30 31 32 33 34 | #import "OFDictionary.h" #import "OFStream.h" #import "OFDataArray.h" #ifdef _WIN32 # import "OFTCPSocket.h" #endif #import "OFThread.h" | < > | 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | #import "OFDictionary.h" #import "OFStream.h" #import "OFDataArray.h" #ifdef _WIN32 # import "OFTCPSocket.h" #endif #import "OFThread.h" #ifdef HAVE_KQUEUE # import "OFStreamObserver_kqueue.h" #endif #ifdef HAVE_POLL_H # import "OFStreamObserver_poll.h" #endif #if defined(HAVE_SYS_SELECT_H) || defined(_WIN32) # import "OFStreamObserver_select.h" #endif #import "OFInitializationFailedException.h" #import "OFNotImplementedException.h" #import "OFOutOfRangeException.h" #import "autorelease.h" #import "macros.h" enum { QUEUE_ADD = 0, QUEUE_REMOVE = 1, QUEUE_READ = 0, QUEUE_WRITE = 2 |
︙ | ︙ | |||
374 375 376 377 378 379 380 | { @throw [OFNotImplementedException exceptionWithClass: [self class] selector: _cmd]; } - (BOOL)_processCache { | < < > > | < < | 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 | { @throw [OFNotImplementedException exceptionWithClass: [self class] selector: _cmd]; } - (BOOL)_processCache { OFStream **objects = [readStreams objects]; size_t i, count = [readStreams count]; BOOL foundInCache = NO; for (i = 0; i < count; i++) { if ([objects[i] pendingBytes] > 0 && ![objects[i] _isWaitingForDelimiter]) { void *pool = objc_autoreleasePoolPush(); [delegate streamIsReadyForReading: objects[i]]; foundInCache = YES; objc_autoreleasePoolPop(pool); } } /* * As long as we have data in the cache for any stream, we don't want * to block. */ if (foundInCache) return YES; |
︙ | ︙ |