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
|
- (void)OF_removeObjectForReading: (id)object
{
/* TODO: Adjust _maxFD */
int fd = [object fileDescriptorForReading];
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 < 0 || fd >= FD_SETSIZE)
@throw [OFOutOfRangeException exception];
FD_CLR(fd, &_writeFDs);
}
- (void)observeForTimeInterval: (of_time_interval_t)timeInterval
{
void *pool = objc_autoreleasePoolPush();
|
|
>
>
>
>
>
|
>
>
>
>
>
|
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
|
- (void)OF_removeObjectForReading: (id)object
{
/* TODO: Adjust _maxFD */
int fd = [object fileDescriptorForReading];
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
{
/* TODO: Adjust _maxFD */
int fd = [object fileDescriptorForWriting];
if (fd < 0)
@throw [OFOutOfRangeException exception];
#ifndef _WIN32
if (fd >= FD_SETSIZE)
@throw [OFOutOfRangeException exception];
#endif
FD_CLR(fd, &_writeFDs);
}
- (void)observeForTimeInterval: (of_time_interval_t)timeInterval
{
void *pool = objc_autoreleasePoolPush();
|
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
|
if (events < 0)
@throw [OFObserveFailedException exceptionWithObserver: self
errNo: errno];
if (FD_ISSET(_cancelFD[0], &readFDs)) {
char buffer;
#ifndef _WIN32
OF_ENSURE(read(_cancelFD[0], &buffer, 1) == 1);
#else
OF_ENSURE(recvfrom(_cancelFD[0], &buffer, 1, 0, NULL,
NULL) == 1);
#endif
}
|
|
|
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
|
if (events < 0)
@throw [OFObserveFailedException exceptionWithObserver: self
errNo: errno];
if (FD_ISSET(_cancelFD[0], &readFDs)) {
char buffer;
#ifdef OF_HAVE_PIPE
OF_ENSURE(read(_cancelFD[0], &buffer, 1) == 1);
#else
OF_ENSURE(recvfrom(_cancelFD[0], &buffer, 1, 0, NULL,
NULL) == 1);
#endif
}
|