Differences From Artifact [d4951ca160]:
- File
src/OFKernelEventObserver_kqueue.m
— part of check-in
[c694569d86]
at
2014-01-29 15:54:59
on branch trunk
— Generalize OFKernelEventObserver
It is no longer limited to streams now. (user: js, size: 3880) [annotate] [blame] [check-ins using]
To Artifact [79faaa634a]:
- File
src/OFKernelEventObserver_kqueue.m
— part of check-in
[41ca862453]
at
2014-02-04 09:41:38
on branch trunk
— OFKernelEventObserver_kqueue: Ignore EBADF
Removed file descriptors were returned in the event list with EBADF if
the file descriptor has been closed before removing them. Interpreting
that as a read event caused problems, as the file descriptor could not
be mapped to an object anymore, thus the entry in the event list is
skipped now if there was a EBADF error. (user: js, size: 4888) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
148 149 150 151 152 153 154 155 156 157 158 159 160 161 | continue; } realEvents++; pool = objc_autoreleasePoolPush(); switch (eventList[i].filter) { case EVFILT_READ: if ([_delegate respondsToSelector: @selector(objectIsReadyForReading:)]) [_delegate objectIsReadyForReading: _FDToObject[eventList[i].ident]]; break; | > > > > > > > > > > > > > > > > > > > > > > > > | 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 | continue; } realEvents++; pool = objc_autoreleasePoolPush(); /* * If a file descriptor has been closed before it is removed * from the kernel event observer, the file descriptor is not * valid anymore and causes EBADF. As closing a file descriptor * automatically removes it from the queue, there is nothing to * do anymore. * * Ideally, a file descriptor should never be closed before it * is removed from the kernel event observer, as in rare cases, * it could result in removing the wrong object from the kernel * event observer, for example if a file descriptor is closed, * a new one created, added to the kernel event observer and * then the old one removed, as the new one could now have the * same file descriptor as the closed one had and thus the new * one is removed. * * For other errors, call the callback like it was successful * so that the read / write will generate an error and throw an * exception. */ if ((eventList[i].flags & EV_ERROR) && eventList[i].data == EBADF) continue; switch (eventList[i].filter) { case EVFILT_READ: if ([_delegate respondsToSelector: @selector(objectIsReadyForReading:)]) [_delegate objectIsReadyForReading: _FDToObject[eventList[i].ident]]; break; |
︙ | ︙ |