Overview
Comment: | Improve OFStreamObserver.
It also looks at the cache of each stream now and does not block if |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
b554732eaee65ed20141c7e2644c11d4 |
User & Date: | js on 2010-09-19 02:52:19 |
Other Links: | manifest | tags |
Context
2010-09-19
| ||
22:35 | Add -[unicodeString] to OFString. check-in: b5f0fc343d user: js tags: trunk | |
02:52 | Improve OFStreamObserver. check-in: b554732eae user: js tags: trunk | |
02:34 | Only handle the first matching object in OFMutalbeArray operations. check-in: de45535c23 user: js tags: trunk | |
Changes
Modified src/OFStream.h from [c21dc06749] to [dd21d0d02a].
︙ | |||
23 24 25 26 27 28 29 | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | + - + + + | * _writeNBytes:fromBuffer: and _atEndOfStream, but nothing else. Those are not * defined in the headers, but do the actual work. OFStream uses those and does * all the caching and other stuff. If you override these methods without the * _ prefix, you *WILL* break caching and get broken results! */ @interface OFStream: OFObject { @public |
︙ |
Modified src/OFStreamObserver.h from [943d945622] to [572eeb8e96].
︙ | |||
22 23 24 25 26 27 28 29 30 31 32 33 34 35 | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | + | # include <windows.h> #endif @class OFStream; #ifdef OF_HAVE_POLL @class OFDataArray; #endif @class OFMutableArray; @class OFMutableDictionary; /** * \brief A protocol that needs to be implemented by delegates for * OFStreamObserver. */ @protocol OFStreamObserverDelegate |
︙ | |||
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | + + + - | @end /** * \brief A class that can observe multiple streams at once. */ @interface OFStreamObserver: OFObject { OFMutableArray *readStreams; OFMutableArray *writeStreams; id <OFStreamObserverDelegate> delegate; #ifdef OF_HAVE_POLL OFDataArray *fds; OFMutableDictionary *fdToStream; #else fd_set readfds; fd_set writefds; int nfds; #endif |
︙ |
Modified src/OFStreamObserver.m from [7ad4630322] to [2babecb315].
︙ | |||
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | 15 16 17 18 19 20 21 22 23 24 25 26 27 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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | + + + + - + + + - - + + + - + + + + + + - | #ifdef OF_HAVE_POLL # include <poll.h> #endif #import "OFStreamObserver.h" #import "OFDataArray.h" #import "OFArray.h" #import "OFDictionary.h" #import "OFStream.h" #import "OFNumber.h" #import "OFAutoreleasePool.h" #import "OFExceptions.h" @implementation OFStreamObserver + streamObserver { return [[[self alloc] init] autorelease]; } - init { self = [super init]; @try { readStreams = [[OFMutableArray alloc] init]; writeStreams = [[OFMutableArray alloc] init]; #ifdef OF_HAVE_POLL |
︙ | |||
132 133 134 135 136 137 138 | 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 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 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 | - - - - - - - - - - - + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + | @throw [OFOutOfRangeException newWithClass: isa]; FD_SET(fd, fdset); if (fd >= nfds) nfds = fd + 1; |
︙ | |||
236 237 238 239 240 241 242 | 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 | - - - - - - - - - + - - + - - - - + + + + + + + + + + + + | stream = [fdToStream objectForKey: num]; [delegate streamDidBecomeReadyForReading: stream]; } fds_c[i].revents = 0; } #else |
︙ |