Overview
Context
Changes
Modified src/OFKernelEventObserver_select.m
from [331bf675cd]
to [69ccd8df63].
︙ | | |
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
|
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
|
-
+
-
+
-
+
-
+
|
return self;
}
- (void)OF_addObjectForReading: (id)object
{
int fd = [object fileDescriptorForReading];
if (fd > INT_MAX - 1)
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
{
int fd = [object fileDescriptorForWriting];
if (fd > INT_MAX - 1)
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
{
/* TODO: Adjust _maxFD */
int fd = [object fileDescriptorForReading];
if (fd >= FD_SETSIZE)
if (fd < 0 || fd >= FD_SETSIZE)
@throw [OFOutOfRangeException exception];
FD_CLR(fd, &_readFDs);
}
- (void)OF_removeObjectForWriting: (id)object
{
/* TODO: Adjust _maxFD */
int fd = [object fileDescriptorForWriting];
if (fd >= FD_SETSIZE)
if (fd < 0 || fd >= FD_SETSIZE)
@throw [OFOutOfRangeException exception];
FD_CLR(fd, &_writeFDs);
}
- (void)observeForTimeInterval: (of_time_interval_t)timeInterval
{
|
︙ | | |
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
|
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
|
-
+
+
-
+
+
|
#endif
}
objects = [_readObjects objects];
count = [_readObjects count];
for (i = 0; i < count; i++) {
int fd = [objects[i] fileDescriptorForReading];
int fd;
pool = objc_autoreleasePoolPush();
fd = [objects[i] fileDescriptorForReading];
if (FD_ISSET(fd, &readFDs) && [_delegate respondsToSelector:
@selector(objectIsReadyForReading:)])
[_delegate objectIsReadyForReading: objects[i]];
objc_autoreleasePoolPop(pool);
}
objects = [_writeObjects objects];
count = [_writeObjects count];
for (i = 0; i < count; i++) {
int fd = [objects[i] fileDescriptorForWriting];
int fd;
pool = objc_autoreleasePoolPush();
fd = [objects[i] fileDescriptorForWriting];
if (FD_ISSET(fd, &writeFDs) && [_delegate respondsToSelector:
@selector(objectIsReadyForWriting:)])
[_delegate objectIsReadyForWriting: objects[i]];
objc_autoreleasePoolPop(pool);
}
}
@end
|