Overview
Comment: | OFKernelEventObserver*.m: Minor cleanup |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
5924cc3a9217da95fa537b3aaf4a348e |
User & Date: | js on 2015-04-14 19:34:52 |
Other Links: | manifest | tags |
Context
2015-04-14
| ||
19:46 | Add a few more const check-in: 5d729d9ba0 user: js tags: trunk | |
19:34 | OFKernelEventObserver*.m: Minor cleanup check-in: 5924cc3a92 user: js tags: trunk | |
2015-04-13
| ||
11:56 | OFZIPArchive: Exclude bit 11 from GPBF comparison check-in: 037a74f7e6 user: js tags: trunk | |
Changes
Modified src/OFKernelEventObserver.m from [e8b15decf5] to [628ba88c27].
︙ | ︙ | |||
403 404 405 406 407 408 409 410 411 412 | - (bool)OF_processCache { id const *objects = [_readObjects objects]; size_t i, count = [_readObjects count]; bool foundInCache = false; for (i = 0; i < count; i++) { if ([objects[i] isKindOfClass: [OFStream class]] && [objects[i] hasDataInReadBuffer] && ![objects[i] OF_isWaitingForDelimiter]) { | > > < < | < | > | 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 | - (bool)OF_processCache { id const *objects = [_readObjects objects]; size_t i, count = [_readObjects count]; bool foundInCache = false; for (i = 0; i < count; i++) { void *pool = objc_autoreleasePoolPush(); if ([objects[i] isKindOfClass: [OFStream class]] && [objects[i] hasDataInReadBuffer] && ![objects[i] OF_isWaitingForDelimiter]) { if ([_delegate respondsToSelector: @selector(objectIsReadyForReading:)]) [_delegate objectIsReadyForReading: objects[i]]; foundInCache = true; } objc_autoreleasePoolPop(pool); } /* * As long as we have data in the cache for any stream, we don't want * to block. */ if (foundInCache) |
︙ | ︙ |
Modified src/OFKernelEventObserver_kqueue.m from [80d98ba3c7] to [5dab973998].
︙ | ︙ | |||
33 34 35 36 37 38 39 | #import "OFDataArray.h" #import "OFArray.h" #import "OFInitializationFailedException.h" #import "OFObserveFailedException.h" #import "OFOutOfRangeException.h" | < < | 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | #import "OFDataArray.h" #import "OFArray.h" #import "OFInitializationFailedException.h" #import "OFObserveFailedException.h" #import "OFOutOfRangeException.h" #define EVENTLIST_SIZE 64 @implementation OFKernelEventObserver_kqueue - init { self = [super init]; |
︙ | ︙ | |||
124 125 126 127 128 129 130 | } - (bool)observeForTimeInterval: (of_time_interval_t)timeInterval { void *pool = objc_autoreleasePoolPush(); struct timespec timeout; struct kevent eventList[EVENTLIST_SIZE]; | | < < < | > > | < < > > | 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | } - (bool)observeForTimeInterval: (of_time_interval_t)timeInterval { void *pool = objc_autoreleasePoolPush(); struct timespec timeout; struct kevent eventList[EVENTLIST_SIZE]; int i, events, realEvents = 0; timeout.tv_sec = (time_t)timeInterval; timeout.tv_nsec = lrint((timeInterval - timeout.tv_sec) * 1000000000); /* * Make sure to keep the streams retained and thus the file descriptors * valid until the actual change has been performed. */ [self OF_processQueueAndStoreRemovedIn: _removedArray]; if ([self OF_processCache]) { objc_autoreleasePoolPop(pool); return true; } objc_autoreleasePoolPop(pool); events = kevent(_kernelQueue, [_changeList items], (int)[_changeList count], eventList, EVENTLIST_SIZE, (timeInterval == -1 ? NULL : &timeout)); if (events < 0) return [OFObserveFailedException exceptionWithObserver: self errNo: errno]; [_changeList removeAllItems]; [_removedArray removeAllObjects]; if (events == 0) return false; for (i = 0; i < events; i++) { if (eventList[i].ident == _cancelFD[0]) { char buffer; assert(eventList[i].filter == EVFILT_READ); OF_ENSURE(read(_cancelFD[0], &buffer, 1) == 1); continue; } pool = objc_autoreleasePoolPush(); switch (eventList[i].filter) { case EVFILT_READ: if ([_delegate respondsToSelector: @selector(objectIsReadyForReading:)]) [_delegate objectIsReadyForReading: _FDToObject[eventList[i].ident]]; break; case EVFILT_WRITE: if ([_delegate respondsToSelector: @selector(objectIsReadyForWriting:)]) [_delegate objectIsReadyForWriting: _FDToObject[eventList[i].ident]]; break; default: assert(0); } objc_autoreleasePoolPop(pool); realEvents++; } if (realEvents == 0) return false; return true; } @end |
Modified src/OFKernelEventObserver_poll.m from [5e6cfe7441] to [c6c9ef266d].
︙ | ︙ | |||
161 162 163 164 165 166 167 | @throw [OFObserveFailedException exceptionWithObserver: self errNo: errno]; if (events == 0) return false; for (i = 0; i < nFDs; i++) { | < < | < > > > > > > > > < < | 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 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 | @throw [OFObserveFailedException exceptionWithObserver: self errNo: errno]; if (events == 0) return false; for (i = 0; i < nFDs; i++) { if (FDs[i].revents & POLLIN) { if (FDs[i].fd == _cancelFD[0]) { char buffer; OF_ENSURE(read(_cancelFD[0], &buffer, 1) == 1); FDs[i].revents = 0; continue; } pool = objc_autoreleasePoolPush(); if ([_delegate respondsToSelector: @selector(objectIsReadyForReading:)]) [_delegate objectIsReadyForReading: _FDToObject[FDs[i].fd]]; objc_autoreleasePoolPop(pool); realEvents++; } if (FDs[i].revents & POLLOUT) { pool = objc_autoreleasePoolPush(); if ([_delegate respondsToSelector: @selector(objectIsReadyForWriting:)]) [_delegate objectIsReadyForWriting: _FDToObject[FDs[i].fd]]; objc_autoreleasePoolPop(pool); realEvents++; } FDs[i].revents = 0; } if (realEvents == 0) return false; return true; } |
︙ | ︙ |
Modified src/OFKernelEventObserver_select.m from [9e96dde949] to [ea8324b0c4].
︙ | ︙ | |||
127 128 129 130 131 132 133 134 | errNo: errno]; if (events == 0) return false; if (FD_ISSET(_cancelFD[0], &readFDs)) { char buffer; #ifndef _WIN32 | > | | | 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | errNo: errno]; if (events == 0) return false; if (FD_ISSET(_cancelFD[0], &readFDs)) { char buffer; #ifndef _WIN32 OF_ENSURE(read(_cancelFD[0], &buffer, 1) == 1); #else OF_ENSURE(recvfrom(_cancelFD[0], &buffer, 1, 0, NULL, NULL) == 1); #endif } objects = [_readObjects objects]; count = [_readObjects count]; for (i = 0; i < count; i++) { |
︙ | ︙ |