77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
queue = [[OFMutableArray alloc] init];
queueInfo = [[OFMutableArray alloc] init];
#ifdef OF_HAVE_POLL
FDs = [[OFDataArray alloc] initWithItemSize:
sizeof(struct pollfd)];
FDToStream = [[OFMutableDictionary alloc] init];
#else
FD_ZERO(&readfds);
FD_ZERO(&writefds);
#endif
#ifndef _WIN32
if (pipe(cancelFD))
@throw [OFInitializationFailedException
newWithClass: isa];
#else
|
|
|
|
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
queue = [[OFMutableArray alloc] init];
queueInfo = [[OFMutableArray alloc] init];
#ifdef OF_HAVE_POLL
FDs = [[OFDataArray alloc] initWithItemSize:
sizeof(struct pollfd)];
FDToStream = [[OFMutableDictionary alloc] init];
#else
FD_ZERO(&readFDs);
FD_ZERO(&writeFDs);
#endif
#ifndef _WIN32
if (pipe(cancelFD))
@throw [OFInitializationFailedException
newWithClass: isa];
#else
|
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
|
{
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
int fileDescriptor = [stream fileDescriptor];
FD_SET(fileDescriptor, FDSet);
FD_SET(fileDescriptor, &exceptFDs);
if (fd >= nfds)
nfds = fd + 1;
[pool release];
}
- (void)_removeStream: (OFStream*)stream
withFDSet: (fd_set*)FDSet
otherFDSet: (fd_set*)otherFDSet
{
int fileDescriptor = [stream fileDescriptor];
FD_CLR(fileDescriptor, FDSet);
if (!FD_ISSET(fileDescriptor, otherFDSet))
FD_CLR(fileDescriptor, &exceptfds);
}
#endif
- (void)addStreamToObserveForReading: (OFStream*)stream
{
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
OFNumber *qi = [OFNumber numberWithInt: QUEUE_ADD | QUEUE_READ];
|
|
|
|
|
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
|
{
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
int fileDescriptor = [stream fileDescriptor];
FD_SET(fileDescriptor, FDSet);
FD_SET(fileDescriptor, &exceptFDs);
if (fileDescriptor >= nFDs)
nFDs = fileDescriptor + 1;
[pool release];
}
- (void)_removeStream: (OFStream*)stream
withFDSet: (fd_set*)FDSet
otherFDSet: (fd_set*)otherFDSet
{
int fileDescriptor = [stream fileDescriptor];
FD_CLR(fileDescriptor, FDSet);
if (!FD_ISSET(fileDescriptor, otherFDSet))
FD_CLR(fileDescriptor, &exceptFDs);
}
#endif
- (void)addStreamToObserveForReading: (OFStream*)stream
{
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
OFNumber *qi = [OFNumber numberWithInt: QUEUE_ADD | QUEUE_READ];
|