ObjFW  Check-in [321274075d]

Overview
Comment:Fix small bugs introduced by the last commit.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 321274075d19a624ff30dce3f1854cc1ffc34c064b2c4d22c72ec09e032a4516
User & Date: js on 2011-04-02 02:29:56
Other Links: manifest | tags
Context
2011-04-03
10:58
Use a more fitting exception in -[initWithContentsOfFile:]. check-in: 72f2eb445d user: js tags: trunk
2011-04-02
02:29
Fix small bugs introduced by the last commit. check-in: 321274075d user: js tags: trunk
2011-04-01
22:14
Cancel the currently blocking -[observe] when the stream set is changed. check-in: a61ab37726 user: js tags: trunk
Changes

Modified src/OFStreamObserver.m from [864995cc48] to [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) {