ObjFW  Diff

Differences From Artifact [24c0cc0a69]:

To Artifact [fea66ded56]:

  • File src/OFStreamObserver_kqueue.m — part of check-in [e1e7ffa903] at 2011-09-22 23:25:42 on branch trunk — Exceptions are now autoreleased.

    This is safe as an "exception loop" can't happen, since if allocating
    an exception fails, it throws an OFAllocFailedException which is
    preallocated and can always be thrown.

    So, the worst case would be that an autorelease of an exception fails,
    triggering an OFOutOfMemoryException for which there is no memory,
    resulting in an OFAllocFailedException to be thrown. (user: js, size: 3197) [annotate] [blame] [check-ins using]


37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
- init
{
	self = [super init];

	@try {
		if ((kernelQueue = kqueue()) == -1)
			@throw [OFInitializationFailedException
			    newWithClass: isa];

		changeList = [[OFDataArray alloc] initWithItemSize:
		    sizeof(struct kevent)];

		[self _addFileDescriptorForReading: cancelFD[0]];
	} @catch (id e) {
		[self release];







|







37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
- init
{
	self = [super init];

	@try {
		if ((kernelQueue = kqueue()) == -1)
			@throw [OFInitializationFailedException
			    exceptionWithClass: isa];

		changeList = [[OFDataArray alloc] initWithItemSize:
		    sizeof(struct kevent)];

		[self _addFileDescriptorForReading: cancelFD[0]];
	} @catch (id e) {
		[self release];
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
	    (timeout == -1 ? NULL : &timespec));

	if (events == -1) {
		switch (errno) {
		case EINTR:
			return NO;
		case ENOMEM:
			@throw [OFOutOfMemoryException newWithClass: isa];
		default:
			assert(0);
		}
	}

	[changeList removeNItems: [changeList count]];








|







111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
	    (timeout == -1 ? NULL : &timespec));

	if (events == -1) {
		switch (errno) {
		case EINTR:
			return NO;
		case ENOMEM:
			@throw [OFOutOfMemoryException exceptionWithClass: isa];
		default:
			assert(0);
		}
	}

	[changeList removeNItems: [changeList count]];