Differences From Artifact [a00b377b97]:
- File src/OFKernelEventObserver_select.m — part of check-in [3a9dbf5fee] at 2015-10-17 12:17:00 on branch trunk — Fix two forgotten instances of FD_SETSIZE on Win32 (user: js, size: 4857) [annotate] [blame] [check-ins using] [more...]
To Artifact [6e6cb25888]:
- File
src/OFKernelEventObserver_select.m
— part of check-in
[c5f0c5f9ba]
at
2015-12-29 21:42:38
on branch 0.8
— Refactor OFKernelEventObserver
This moves the locked queue for actions to
OFKernelEventObserver_LockedQueue, which is now used for select and
poll, but skipped for kqueue and epoll, as they natively support changes
from another thread.This fixes the problem that removing an object is delayed until the next
observe call - at which point it might have already been closed, meaning
the fd is no longer available. This was mainly a problem with kqueue, as
closing the fd already removed it from the kqueue, which then resulted
in an error being returned when trying to manually remove the fd from
the kqueue. (user: js, size: 4761) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
59 60 61 62 63 64 65 | _maxFD = (int)_cancelFD[0]; return self; } - (void)OF_addObjectForReading: (id)object | < | | < | | > < < > < < | 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 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 | _maxFD = (int)_cancelFD[0]; return self; } - (void)OF_addObjectForReading: (id)object fileDescriptor: (int)fd { if (fd < 0 || fd > INT_MAX - 1) @throw [OFOutOfRangeException exception]; #ifndef _WIN32 if (fd >= FD_SETSIZE) @throw [OFOutOfRangeException exception]; #endif if (fd > _maxFD) _maxFD = fd; FD_SET(fd, &_readFDs); } - (void)OF_addObjectForWriting: (id)object fileDescriptor: (int)fd { if (fd < 0 || fd > INT_MAX - 1) @throw [OFOutOfRangeException exception]; #ifndef _WIN32 if (fd >= FD_SETSIZE) @throw [OFOutOfRangeException exception]; #endif if (fd > _maxFD) _maxFD = fd; FD_SET(fd, &_writeFDs); } - (void)OF_removeObjectForReading: (id)object fileDescriptor: (int)fd { /* TODO: Adjust _maxFD */ if (fd < 0) @throw [OFOutOfRangeException exception]; #ifndef _WIN32 if (fd >= FD_SETSIZE) @throw [OFOutOfRangeException exception]; #endif FD_CLR(fd, &_readFDs); } - (void)OF_removeObjectForWriting: (id)object fileDescriptor: (int)fd { /* TODO: Adjust _maxFD */ if (fd < 0) @throw [OFOutOfRangeException exception]; #ifndef _WIN32 if (fd >= FD_SETSIZE) @throw [OFOutOfRangeException exception]; #endif |
︙ | ︙ | |||
138 139 140 141 142 143 144 | id const *objects; fd_set readFDs; fd_set writeFDs; struct timeval timeout; int events; size_t i, count; | | | 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | id const *objects; fd_set readFDs; fd_set writeFDs; struct timeval timeout; int events; size_t i, count; [self OF_processQueue]; [self OF_processReadBuffers]; objc_autoreleasePoolPop(pool); #ifdef FD_COPY FD_COPY(&_readFDs, &readFDs); FD_COPY(&_writeFDs, &writeFDs); |
︙ | ︙ |