Differences From Artifact [5936ea8b18]:
- File src/OFStreamObserver_kqueue.m — part of check-in [3c99aa51da] at 2012-09-12 06:00:25 on branch trunk — OFStreamObserver: Take a double as timeout. (user: js, size: 3563) [annotate] [blame] [check-ins using]
To Artifact [e69a794cf2]:
- File
src/OFStreamObserver_kqueue.m
— part of check-in
[3de549d6a5]
at
2012-09-12 06:00:29
on branch trunk
— OFStreamObserver: Cancel is no event anymore.
As cancel internally was an event, -[observeWithTimeout:] returned YES
before when an observe call was canceled. Now, the number of real events
is counted and NO returned if this is 0. (user: js, size: 3632) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
99 100 101 102 103 104 105 | } - (BOOL)observeWithTimeout: (double)timeout { void *pool = objc_autoreleasePoolPush(); struct timespec timespec; struct kevent eventList[EVENTLIST_SIZE]; | | | 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | } - (BOOL)observeWithTimeout: (double)timeout { void *pool = objc_autoreleasePoolPush(); struct timespec timespec; struct kevent eventList[EVENTLIST_SIZE]; int i, events, realEvents = 0; timespec.tv_sec = timeout; timespec.tv_nsec = (timeout - timespec.tv_sec) * 1000000000; [self _processQueue]; if ([self _processCache]) { |
︙ | ︙ | |||
142 143 144 145 146 147 148 149 150 151 152 153 154 155 | if (eventList[i].ident == cancelFD[0]) { char buffer; OF_ENSURE(read(cancelFD[0], &buffer, 1) > 0); continue; } pool = objc_autoreleasePoolPush(); if (eventList[i].flags & EV_ERROR) { [delegate streamDidReceiveException: FDToStream[eventList[i].ident]]; objc_autoreleasePoolPop(pool); | > > | 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | if (eventList[i].ident == cancelFD[0]) { char buffer; OF_ENSURE(read(cancelFD[0], &buffer, 1) > 0); continue; } realEvents++; pool = objc_autoreleasePoolPush(); if (eventList[i].flags & EV_ERROR) { [delegate streamDidReceiveException: FDToStream[eventList[i].ident]]; objc_autoreleasePoolPop(pool); |
︙ | ︙ | |||
167 168 169 170 171 172 173 174 175 176 177 | break; default: assert(0); } objc_autoreleasePoolPop(pool); } return YES; } @end | > > > | 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | break; default: assert(0); } objc_autoreleasePoolPop(pool); } if (realEvents == 0) return NO; return YES; } @end |