66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
-
+
|
- (void)dealloc
{
[_FDs release];
[super dealloc];
}
- (void)OF_addObject: (id)object
- (void)of_addObject: (id)object
fileDescriptor: (int)fd
events: (short)events
{
struct pollfd *FDs = [_FDs items];
size_t count = [_FDs count];
bool found = false;
|
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
-
+
|
}
_FDToObject[fd] = object;
[_FDs addItem: &p];
}
}
- (void)OF_removeObject: (id)object
- (void)of_removeObject: (id)object
fileDescriptor: (int)fd
events: (short)events
{
struct pollfd *FDs = [_FDs items];
size_t nFDs = [_FDs count];
for (size_t i = 0; i < nFDs; i++) {
|
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
|
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
|
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
|
}
break;
}
}
}
- (void)OF_addObjectForReading: (id <OFReadyForReadingObserving>)object
- (void)of_addObjectForReading: (id <OFReadyForReadingObserving>)object
{
[self OF_addObject: object
[self of_addObject: object
fileDescriptor: [object fileDescriptorForReading]
events: POLLIN];
}
- (void)OF_addObjectForWriting: (id <OFReadyForWritingObserving>)object
- (void)of_addObjectForWriting: (id <OFReadyForWritingObserving>)object
{
[self OF_addObject: object
[self of_addObject: object
fileDescriptor: [object fileDescriptorForWriting]
events: POLLOUT];
}
- (void)OF_removeObjectForReading: (id <OFReadyForReadingObserving>)object
- (void)of_removeObjectForReading: (id <OFReadyForReadingObserving>)object
{
[self OF_removeObject: object
[self of_removeObject: object
fileDescriptor: [object fileDescriptorForReading]
events: POLLIN];
}
- (void)OF_removeObjectForWriting: (id <OFReadyForWritingObserving>)object
- (void)of_removeObjectForWriting: (id <OFReadyForWritingObserving>)object
{
[self OF_removeObject: object
[self of_removeObject: object
fileDescriptor: [object fileDescriptorForWriting]
events: POLLOUT];
}
- (void)observeForTimeInterval: (of_time_interval_t)timeInterval
{
struct pollfd *FDs;
int events;
size_t nFDs;
[self OF_processQueue];
[self of_processQueue];
if ([self OF_processReadBuffers])
if ([self of_processReadBuffers])
return;
FDs = [_FDs items];
nFDs = [_FDs count];
#ifdef OPEN_MAX
if (nFDs > OPEN_MAX)
|