Differences From Artifact [1648f30d0f]:
- File src/OFStreamObserver_poll.m — part of check-in [e40729d406] at 2013-02-12 18:22:15 on branch trunk — Prefix all ivars with an underscore. (user: js, size: 3844) [annotate] [blame] [check-ins using]
To Artifact [684851fd9c]:
- File
src/OFStreamObserver_poll.m
— part of check-in
[c5ef582958]
at
2013-03-04 17:20:15
on branch trunk
— Replace BOOL with bool.
The only places where BOOL is left are those where they are required by
the ABI. (user: js, size: 3856) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
58 59 60 61 62 63 64 | } - (void)OF_addFileDescriptor: (int)fd withEvents: (short)events { struct pollfd *FDs = [_FDs items]; size_t i, count = [_FDs count]; | | | | 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | } - (void)OF_addFileDescriptor: (int)fd withEvents: (short)events { struct pollfd *FDs = [_FDs items]; size_t i, count = [_FDs count]; bool found = false; for (i = 0; i < count; i++) { if (FDs[i].fd == fd) { FDs[i].events |= events; found = true; break; } } if (!found) { struct pollfd p = { fd, events | POLLERR, 0 }; [_FDs addItem: &p]; |
︙ | ︙ | |||
116 117 118 119 120 121 122 | - (void)OF_removeFileDescriptorForWriting: (int)fd { [self OF_removeFileDescriptor: fd withEvents: POLLOUT]; } | | | | | 116 117 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 | - (void)OF_removeFileDescriptorForWriting: (int)fd { [self OF_removeFileDescriptor: fd withEvents: POLLOUT]; } - (bool)observeWithTimeout: (double)timeout { void *pool = objc_autoreleasePoolPush(); struct pollfd *FDs; size_t i, nFDs, realEvents = 0; [self OF_processQueue]; if ([self OF_processCache]) { objc_autoreleasePoolPop(pool); return true; } objc_autoreleasePoolPop(pool); FDs = [_FDs items]; nFDs = [_FDs count]; #ifdef OPEN_MAX if (nFDs > OPEN_MAX) @throw [OFOutOfRangeException exceptionWithClass: [self class]]; #endif if (poll(FDs, (nfds_t)nFDs, (int)(timeout != -1 ? timeout * 1000 : -1)) < 1) return false; for (i = 0; i < nFDs; i++) { pool = objc_autoreleasePoolPush(); if (FDs[i].revents & POLLIN) { if (FDs[i].fd == _cancelFD[0]) { char buffer; |
︙ | ︙ | |||
189 190 191 192 193 194 195 | FDs[i].revents = 0; objc_autoreleasePoolPop(pool); } if (realEvents == 0) | | | | 189 190 191 192 193 194 195 196 197 198 199 200 | FDs[i].revents = 0; objc_autoreleasePoolPop(pool); } if (realEvents == 0) return false; return true; } @end |