Overview
Comment: | Fix a regression from the previous refactorization
kqueue and epoll were not updating _readObjects and _writeObjects |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | 0.8 |
Files: | files | file ages | folders |
SHA3-256: |
d1c4c467066e7834b182ef7006c1e766 |
User & Date: | js on 2016-01-03 00:36:08 |
Other Links: | branch diff | manifest | tags |
Context
2016-01-03
| ||
00:43 | Update copyright check-in: cec0f072f8 user: js tags: 0.8 | |
00:36 | Fix a regression from the previous refactorization check-in: d1c4c46706 user: js tags: 0.8 | |
2015-12-29
| ||
21:42 | Refactor OFKernelEventObserver check-in: c5f0c5f9ba user: js tags: 0.8 | |
Changes
Modified src/OFKernelEventObserver.h from [b0b3935794] to [f92733e89e].
︙ | |||
18 19 20 21 22 23 24 25 26 27 28 29 30 31 | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | + + + | #import "socket.h" OF_ASSUME_NONNULL_BEGIN @class OFMutableArray OF_GENERIC(ObjectType); @class OFDate; #ifdef OF_HAVE_THREADS @class OFMutex; #endif /*! * @protocol OFKernelEventObserverDelegate * OFKernelEventObserver.h ObjFW/OFKernelEventObserver.h * * @brief A protocol that needs to be implemented by delegates for * OFKernelEventObserver. |
︙ | |||
111 112 113 114 115 116 117 118 119 120 121 122 123 124 | 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | + + + | *_writeObjects; id <OFKernelEventObserverDelegate> _delegate; #ifdef OF_HAVE_PIPE int _cancelFD[2]; #else of_socket_t _cancelFD[2]; struct sockaddr_in _cancelAddr; #endif #ifdef OF_HAVE_THREADS OFMutex *_mutex; #endif } #ifdef OF_HAVE_PROPERTIES @property OF_NULLABLE_PROPERTY (assign) id <OFKernelEventObserverDelegate> delegate; #endif |
︙ |
Modified src/OFKernelEventObserver.m from [8054f8aa66] to [5076db7548].
︙ | |||
23 24 25 26 27 28 29 30 31 32 33 34 35 36 | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | + + + | #import "OFArray.h" #import "OFStream.h" #import "OFStream+Private.h" #ifndef OF_HAVE_PIPE # import "OFStreamSocket.h" #endif #import "OFDate.h" #ifdef OF_HAVE_THREADS # import "OFMutex.h" #endif #ifdef HAVE_KQUEUE # import "OFKernelEventObserver_kqueue.h" #endif #ifdef HAVE_EPOLL # import "OFKernelEventObserver_epoll.h" #endif |
︙ | |||
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 156 157 158 | 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | + + + + + + + + | cancelAddrLen = sizeof(_cancelAddr); if (of_getsockname(_cancelFD[0], (struct sockaddr*)&_cancelAddr, &cancelAddrLen) != 0) @throw [OFInitializationFailedException exceptionWithClass: [self class]]; # endif #endif #ifdef OF_HAVE_THREADS _mutex = [[OFMutex alloc] init]; #endif } @catch (id e) { [self release]; @throw e; } return self; } - (void)dealloc { close(_cancelFD[0]); if (_cancelFD[1] != _cancelFD[0]) close(_cancelFD[1]); [_readObjects release]; [_writeObjects release]; #ifdef OF_HAVE_THREADS [_mutex release]; #endif [super dealloc]; } - (id <OFKernelEventObserverDelegate>)delegate { return _delegate; |
︙ |
Modified src/OFKernelEventObserver_LockedQueue.h from [e60316af1b] to [e5e6d24907].
︙ | |||
16 17 18 19 20 21 22 | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | - - - - - - | #import "OFKernelEventObserver.h" OF_ASSUME_NONNULL_BEGIN @class OFMutableArray OF_GENERIC(ObjectType); @class OFDataArray; |
︙ |
Modified src/OFKernelEventObserver_LockedQueue.m from [dc0778aa90] to [bec31b0210].
︙ | |||
39 40 41 42 43 44 45 | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | - - - - - - - | self = [super init]; @try { _queueActions = [[OFDataArray alloc] initWithItemSize: sizeof(int)]; _queueFDs = [[OFDataArray alloc] initWithItemSize: sizeof(int)]; _queueObjects = [[OFMutableArray alloc] init]; |
︙ |
Modified src/OFKernelEventObserver_epoll.m from [02fb70080b] to [e19549d9cb].
︙ | |||
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | + + + + | #include <unistd.h> #include <sys/epoll.h> #import "OFKernelEventObserver.h" #import "OFKernelEventObserver+Private.h" #import "OFKernelEventObserver_epoll.h" #import "OFArray.h" #import "OFMapTable.h" #import "OFNull.h" #ifdef OF_HAVE_THREADS # import "OFMutex.h" #endif #import "OFInitializationFailedException.h" #import "OFObserveFailedException.h" #define EVENTLIST_SIZE 64 static const of_map_table_functions_t mapFunctions = { NULL }; |
︙ | |||
84 85 86 87 88 89 90 91 | 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 142 143 144 145 146 147 148 149 150 | + - - - - + + + + - + - - - - - - - - + - - + - - + + - + + + + + + + + + + + + + + - + + | [super dealloc]; } - (void)OF_addObject: (id)object fileDescriptor: (int)fd events: (int)addEvents objectsArray: (OFMutableArray*)objectsArray { |
︙ | |||
150 151 152 153 154 155 156 157 158 159 160 161 162 | 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 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | + + + + + + + - + + - + + - + + - + + | @throw [OFObserveFailedException exceptionWithObserver: self errNo: errno]; [_FDToEvents setValue: (void*)events forKey: (void*)(intptr_t)fd]; } [objectsArray removeObjectIdenticalTo: object]; #ifdef OF_HAVE_THREADS } @finally { [_mutex unlock]; } #endif } - (void)addObjectForReading: (id <OFReadyForReadingObserving>)object { [self OF_addObject: object fileDescriptor: [object fileDescriptorForReading] |
︙ |
Modified src/OFKernelEventObserver_kqueue.m from [9085a7dddc] to [d2b671d56c].
︙ | |||
28 29 30 31 32 33 34 35 36 37 38 39 40 41 | 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | + + + | #include <sys/time.h> #import "OFKernelEventObserver.h" #import "OFKernelEventObserver+Private.h" #import "OFKernelEventObserver_kqueue.h" #import "OFDataArray.h" #import "OFArray.h" #ifdef OF_HAVE_THREADS # import "OFMutex.h" #endif #import "OFInitializationFailedException.h" #import "OFObserveFailedException.h" #import "OFOutOfRangeException.h" #define EVENTLIST_SIZE 64 |
︙ | |||
92 93 94 95 96 97 98 | 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 142 143 144 145 146 147 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 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | + + + + + + - + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | event.flags = EV_ADD; #ifndef __NetBSD__ event.udata = object; #else event.udata = (intptr_t)object; #endif #ifdef OF_HAVE_THREADS [_mutex lock]; @try { #endif [_readObjects addObject: object]; |
︙ |