ObjFW  Diff

Differences From Artifact [864995cc48]:

To Artifact [9e9e13990f]:


53
54
55
56
57
58
59

60

61
62
63
64
65
66
67
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69







+

+







}

- init
{
	self = [super init];

	@try {
#ifdef OF_HAVE_POLL
		struct pollfd p = { 0, POLLIN, 0 };
#endif

		readStreams = [[OFMutableArray alloc] init];
		writeStreams = [[OFMutableArray alloc] init];
		queue = [[OFMutableArray alloc] init];
		queueInfo = [[OFMutableArray alloc] init];
#ifdef OF_HAVE_POLL
		fds = [[OFDataArray alloc] initWithItemSize:
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
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







-
+












+
+
+







			@throw [OFInitializationFailedException
			    newWithClass: isa];

#ifdef OF_HAVE_POLL
		p.fd = cancelFd[0];
		[fds addItem: &p];
#else
		FD_SET(cancelFd[0], fdset);
		FD_SET(cancelFd[0], &readfds);
		nfds = cancelFd[0] + 1;
#endif
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}

- (void)dealloc
{
	close(cancelFd[0]);
	close(cancelFd[1]);

	[(id)delegate release];
	[readStreams release];
	[writeStreams release];
	[queue release];
	[queueInfo release];
#ifdef OF_HAVE_POLL
	[fdToStream release];
379
380
381
382
383
384
385

386
387


388
389


390
391
392


393
394
395
396
397
398
399
400
401
384
385
386
387
388
389
390
391


392
393
394

395
396
397


398
399
400

401
402
403
404
405
406
407







+
-
-
+
+

-
+
+

-
-
+
+

-







	if (poll(fds_c, (nfds_t)nfds, timeout) < 1)
		return NO;

	for (i = 0; i < nfds; i++) {
		OFNumber *num;
		OFStream *stream;

		if (fds_c[i].revents & POLLIN) {
		if (fds_c[i].fd == cancelFd[0]) {
			char buf;
			if (fds_c[i].fd == cancelFd[0]) {
				char buf;

			read(cancelFd[0], &buf, 1);
				read(cancelFd[0], &buf, 1);
				fds_c[i].revents = 0;

			continue;
		}
				continue;
			}

		if (fds_c[i].revents & POLLIN) {
			num = [OFNumber numberWithInt: fds_c[i].fd];
			stream = [fdToStream objectForKey: num];
			[delegate streamDidBecomeReadyForReading: stream];
			[pool releaseObjects];
		}

		if (fds_c[i].revents & POLLOUT) {