ObjFW  Diff

Differences From Artifact [89d321be6d]:

To Artifact [75b0a6497b]:


135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
		if (getsockname(cancelFD[0], (struct sockaddr*)&cancelAddr,
		    &cancelAddrLen))
			@throw [OFInitializationFailedException
			    exceptionWithClass: isa];
#endif

		maxFD = cancelFD[0];
		FDToStream = [self allocMemoryForNItems: maxFD + 1
						 ofSize: sizeof(OFStream*)];
		FDToStream[cancelFD[0]] = nil;

#ifdef OF_THREADS
		mutex = [[OFMutex alloc] init];
#endif
	} @catch (id e) {
		[self release];







|
|







135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
		if (getsockname(cancelFD[0], (struct sockaddr*)&cancelAddr,
		    &cancelAddrLen))
			@throw [OFInitializationFailedException
			    exceptionWithClass: isa];
#endif

		maxFD = cancelFD[0];
		FDToStream = [self allocMemoryWithItemSize: sizeof(OFStream*)
						     count: maxFD + 1];
		FDToStream[cancelFD[0]] = nil;

#ifdef OF_THREADS
		mutex = [[OFMutex alloc] init];
#endif
	} @catch (id e) {
		[self release];
308
309
310
311
312
313
314
315
316

317
318
319
320
321
322
323
			int fd = queueFDsCArray[i];

			if ((action & QUEUE_ACTION) == QUEUE_ADD) {
				if (fd > maxFD) {
					maxFD = fd;
					FDToStream = [self
					    resizeMemory: FDToStream
						toNItems: maxFD + 1
						  ofSize: sizeof(OFStream*)];

				}

				FDToStream[fd] = stream;
			}

			if ((action & QUEUE_ACTION) == QUEUE_REMOVE) {
				/* FIXME: Maybe downsize? */







<
|
>







308
309
310
311
312
313
314

315
316
317
318
319
320
321
322
323
			int fd = queueFDsCArray[i];

			if ((action & QUEUE_ACTION) == QUEUE_ADD) {
				if (fd > maxFD) {
					maxFD = fd;
					FDToStream = [self
					    resizeMemory: FDToStream

						itemSize: sizeof(OFStream*)
						   count: maxFD + 1];
				}

				FDToStream[fd] = stream;
			}

			if ((action & QUEUE_ACTION) == QUEUE_REMOVE) {
				/* FIXME: Maybe downsize? */
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366

				break;
			default:
				assert(0);
			}
		}

		[queue removeNObjects: count];
		[queueInfo removeNItems: count];
		[queueFDs removeNItems: count];
	} @finally {
		[mutex unlock];
	}
}

- (void)observe
{







|
|
|







350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366

				break;
			default:
				assert(0);
			}
		}

		[queue removeAllObjects];
		[queueInfo removeAllItems];
		[queueFDs removeAllItems];
	} @finally {
		[mutex unlock];
	}
}

- (void)observe
{