Differences From Artifact [c790e3741d]:
- File src/OFSelectKernelEventObserver.m — part of check-in [c7f0229795] at 2020-01-02 01:51:34 on branch trunk — Update copyright (user: js, size: 6012) [annotate] [blame] [check-ins using]
To Artifact [2d6e268dc3]:
- File
src/OFSelectKernelEventObserver.m
— part of check-in
[24eff635db]
at
2020-01-07 20:28:41
on branch trunk
— OFKernelEventObserver: Remove queueing of actions
This removes the ability to let a thread add or remove objects for
another thread. This features wasn't used at all, but caused significant
problems with kqueue and epoll, as this often resulted in removing a
file descriptor after it had already been closed. (user: js, size: 5898) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
29 30 31 32 33 34 35 | #include <errno.h> #include <string.h> #include <sys/time.h> #import "OFSelectKernelEventObserver.h" #import "OFArray.h" | < < | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | #include <errno.h> #include <string.h> #include <sys/time.h> #import "OFSelectKernelEventObserver.h" #import "OFArray.h" #import "OFInitializationFailedException.h" #import "OFObserveFailedException.h" #import "OFOutOfRangeException.h" #import "socket_helpers.h" |
︙ | ︙ | |||
69 70 71 72 73 74 75 | _maxFD = (int)_cancelFD[0]; #endif return self; } | | | | | | 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 127 128 129 130 131 132 133 134 | _maxFD = (int)_cancelFD[0]; #endif return self; } - (void)addObjectForReading: (id <OFReadyForReadingObserving>)object { int fd = object.fileDescriptorForReading; if (fd < 0 || fd > INT_MAX - 1) @throw [OFOutOfRangeException exception]; #ifndef OF_WINDOWS if (fd >= (int)FD_SETSIZE) @throw [OFOutOfRangeException exception]; #endif if (fd > _maxFD) _maxFD = fd; FD_SET((of_socket_t)fd, &_readFDs); } - (void)addObjectForWriting: (id <OFReadyForWritingObserving>)object { int fd = object.fileDescriptorForWriting; if (fd < 0 || fd > INT_MAX - 1) @throw [OFOutOfRangeException exception]; #ifndef OF_WINDOWS if (fd >= (int)FD_SETSIZE) @throw [OFOutOfRangeException exception]; #endif if (fd > _maxFD) _maxFD = fd; FD_SET((of_socket_t)fd, &_writeFDs); } - (void)removeObjectForReading: (id <OFReadyForReadingObserving>)object { /* TODO: Adjust _maxFD */ int fd = object.fileDescriptorForReading; if (fd < 0) @throw [OFOutOfRangeException exception]; #ifndef OF_WINDOWS if (fd >= (int)FD_SETSIZE) @throw [OFOutOfRangeException exception]; #endif FD_CLR((of_socket_t)fd, &_readFDs); } - (void)removeObjectForWriting: (id <OFReadyForWritingObserving>)object { /* TODO: Adjust _maxFD */ int fd = object.fileDescriptorForWriting; if (fd < 0) @throw [OFOutOfRangeException exception]; |
︙ | ︙ | |||
151 152 153 154 155 156 157 | struct timeval timeout; int events; #ifdef OF_AMIGAOS ULONG execSignalMask, cancelSignal; #endif size_t count; | < < | 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | struct timeval timeout; int events; #ifdef OF_AMIGAOS ULONG execSignalMask, cancelSignal; #endif size_t count; if ([self of_processReadBuffers]) return; #ifdef FD_COPY FD_COPY(&_readFDs, &readFDs); FD_COPY(&_writeFDs, &writeFDs); #else |
︙ | ︙ |