Differences From Artifact [e66acd4ec0]:
- File
src/OFKernelEventObserver_select.m
— part of check-in
[45518ae7b7]
at
2016-03-20 14:07:47
on branch trunk
— Use the locked queue for kqueue and epoll as well
_readObjects must only be changed from the thread running the observer
and not from a thread adding or removing objects to observe. This is
already handled by the locked queue used by poll and select, so the best
way to solve this is to use the locked queue for kqueue and epoll as
well. (user: js, size: 4955) [annotate] [blame] [check-ins using]
To Artifact [851bfffddf]:
- File
src/OFKernelEventObserver_select.m
— part of check-in
[e74fc30f5b]
at
2016-05-28 14:56:45
on branch trunk
— OFKernelEventObserver_select: Cast to of_socket_t
This makes sure the correct type is used for FD_*. (user: js, size: 5045) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
75 76 77 78 79 80 81 | if (fd >= FD_SETSIZE) @throw [OFOutOfRangeException exception]; #endif if (fd > _maxFD) _maxFD = fd; | | | | | | 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 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 | if (fd >= FD_SETSIZE) @throw [OFOutOfRangeException exception]; #endif if (fd > _maxFD) _maxFD = fd; FD_SET((of_socket_t)fd, &_readFDs); } - (void)OF_addObjectForWriting: (id <OFReadyForWritingObserving>)object { int fd = [object fileDescriptorForWriting]; if (fd < 0 || fd > INT_MAX - 1) @throw [OFOutOfRangeException exception]; #ifndef OF_WINDOWS if (fd >= FD_SETSIZE) @throw [OFOutOfRangeException exception]; #endif if (fd > _maxFD) _maxFD = fd; FD_SET((of_socket_t)fd, &_writeFDs); } - (void)OF_removeObjectForReading: (id <OFReadyForReadingObserving>)object { /* TODO: Adjust _maxFD */ int fd = [object fileDescriptorForReading]; if (fd < 0) @throw [OFOutOfRangeException exception]; #ifndef OF_WINDOWS if (fd >= FD_SETSIZE) @throw [OFOutOfRangeException exception]; #endif FD_CLR((of_socket_t)fd, &_readFDs); } - (void)OF_removeObjectForWriting: (id <OFReadyForWritingObserving>)object { /* TODO: Adjust _maxFD */ int fd = [object fileDescriptorForWriting]; if (fd < 0) @throw [OFOutOfRangeException exception]; #ifndef OF_WINDOWS if (fd >= FD_SETSIZE) @throw [OFOutOfRangeException exception]; #endif FD_CLR((of_socket_t)fd, &_writeFDs); } - (void)observeForTimeInterval: (of_time_interval_t)timeInterval { id const *objects; fd_set readFDs; fd_set writeFDs; |
︙ | ︙ | |||
190 191 192 193 194 195 196 | objects = [_readObjects objects]; count = [_readObjects count]; for (size_t i = 0; i < count; i++) { void *pool = objc_autoreleasePoolPush(); int fd = [objects[i] fileDescriptorForReading]; | > | > | | 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 | objects = [_readObjects objects]; count = [_readObjects count]; for (size_t i = 0; i < count; i++) { void *pool = objc_autoreleasePoolPush(); int fd = [objects[i] fileDescriptorForReading]; if (FD_ISSET((of_socket_t)fd, &readFDs) && [_delegate respondsToSelector: @selector(objectIsReadyForReading:)]) [_delegate objectIsReadyForReading: objects[i]]; objc_autoreleasePoolPop(pool); } objects = [_writeObjects objects]; count = [_writeObjects count]; for (size_t i = 0; i < count; i++) { void *pool = objc_autoreleasePoolPush(); int fd = [objects[i] fileDescriptorForWriting]; if (FD_ISSET((of_socket_t)fd, &writeFDs) && [_delegate respondsToSelector: @selector(objectIsReadyForWriting:)]) [_delegate objectIsReadyForWriting: objects[i]]; objc_autoreleasePoolPop(pool); } } @end |