ObjFW  Diff

Differences From Artifact [2129421b71]:

To Artifact [5b1f9ce35e]:

  • File src/OFKernelEventObserver.h — 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: 6542) [annotate] [blame] [check-ins using]


88
89
90
91
92
93
94
95

96
97
98
99
100
101
102
88
89
90
91
92
93
94

95
96
97
98
99
100
101
102







-
+







- (int)fileDescriptorForWriting;
@end

/*!
 * @brief A class that can observe multiple kernel events (e.g. streams being
 *	  ready to read) at once.
 *
 * @note Currently, Win32 can only observe TCP sockets!
 * @note Currently, Win32 can only observe TCP and UDP sockets!
 */
@interface OFKernelEventObserver: OFObject
{
	OFMutableArray *_readObjects;
	OFMutableArray *_writeObjects;
	__unsafe_unretained id *_FDToObject;
	size_t _maxFD;
186
187
188
189
190
191
192
193

194
195
196
197
198
199
200
201
202

203
204
205
206
207
208
209
186
187
188
189
190
191
192

193
194
195
196
197
198
199
200
201

202
203
204
205
206
207
208
209







-
+








-
+







- (void)observe;

/*!
 * @brief Observes all objects until an event happens on an object or the
 *	  timeout is reached.
 *
 * @param timeInterval The time to wait for an event, in seconds
 * @return A boolean whether events occurred during the timeinterval
 * @return A boolean whether events occurred before returning
 */
- (bool)observeForTimeInterval: (of_time_interval_t)timeInterval;

/*!
 * @brief Observes all objects until an event happens on an object or the
 *	  specified date is reached.
 *
 * @param date The until which to observe
 * @return A boolean whether events occurred until the specified date
 * @return A boolean whether events occurred before returning
 */
- (bool)observeUntilDate: (OFDate*)date;

/*!
 * @brief Cancels the currently blocking observe call.
 *
 * This is automatically done when a new object is added or removed by another