Differences From Artifact [a76eca16d0]:
- File src/OFStreamObserver_select.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: 3317) [annotate] [blame] [check-ins using]
To Artifact [eb397d13f9]:
- File
src/OFStreamObserver_select.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: 3455) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
73 74 75 76 77 78 79 | { void *pool = objc_autoreleasePoolPush(); OFStream **objects; fd_set readFDs_; fd_set writeFDs_; fd_set exceptFDs_; struct timeval time; | | | 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | { void *pool = objc_autoreleasePoolPush(); OFStream **objects; fd_set readFDs_; fd_set writeFDs_; fd_set exceptFDs_; struct timeval time; size_t i, count, realEvents = 0; [self _processQueue]; if ([self _processCache]) { objc_autoreleasePoolPop(pool); return YES; } |
︙ | ︙ | |||
118 119 120 121 122 123 124 | count = [readStreams count]; for (i = 0; i < count; i++) { int fileDescriptor = [objects[i] fileDescriptor]; pool = objc_autoreleasePoolPush(); | | > | > > | > | > | > > > > > | 118 119 120 121 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 | count = [readStreams count]; for (i = 0; i < count; i++) { int fileDescriptor = [objects[i] fileDescriptor]; pool = objc_autoreleasePoolPush(); if (FD_ISSET(fileDescriptor, &readFDs_)) { realEvents++; [delegate streamIsReadyForReading: objects[i]]; } if (FD_ISSET(fileDescriptor, &exceptFDs_)) { realEvents++; [delegate streamDidReceiveException: objects[i]]; /* * Prevent calling it twice in case the FD is in both * sets. */ FD_CLR(fileDescriptor, &exceptFDs_); } objc_autoreleasePoolPop(pool); } objects = [writeStreams objects]; count = [writeStreams count]; for (i = 0; i < count; i++) { int fileDescriptor = [objects[i] fileDescriptor]; pool = objc_autoreleasePoolPush(); if (FD_ISSET(fileDescriptor, &writeFDs_)) { realEvents++; [delegate streamIsReadyForWriting: objects[i]]; } if (FD_ISSET(fileDescriptor, &exceptFDs_)) { realEvents++; [delegate streamDidReceiveException: objects[i]]; } objc_autoreleasePoolPop(pool); } if (realEvents == 0) return NO; return YES; } @end |