ObjFW  Diff

Differences From Artifact [63c9f7d74b]:

To Artifact [73642ffd8c]:


46
47
48
49
50
51
52



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64


65
66
67
68
69
70
71







+
+
+









-
-








@implementation OFSelectKernelEventObserver
- (instancetype)init
{
	self = [super init];

	@try {
		FD_ZERO(&_readFDs);
		FD_ZERO(&_writeFDs);

#ifdef OF_AMIGAOS
		_maxFD = 0;
#else
# ifndef OF_WINDOWS
		if (_cancelFD[0] >= (int)FD_SETSIZE)
			@throw [OFInitializationFailedException
			    exceptionWithClass: self.class];
# endif

		FD_ZERO(&_readFDs);
		FD_ZERO(&_writeFDs);
		FD_SET(_cancelFD[0], &_readFDs);

		if (_cancelFD[0] > INT_MAX)
			@throw [OFOutOfRangeException exception];

		_maxFD = (int)_cancelFD[0];
#endif
168
169
170
171
172
173
174

175

176
177
178
179
180
181
182
169
170
171
172
173
174
175
176

177
178
179
180
181
182
183
184







+
-
+







- (void)observeForTimeInterval: (of_time_interval_t)timeInterval
{
	fd_set readFDs;
	fd_set writeFDs;
	struct timeval timeout;
	int events;
#ifdef OF_AMIGAOS
	BYTE cancelSignal;
	ULONG execSignalMask, cancelSignal;
	ULONG execSignalMask;
#endif
	void *pool;

	if ([self of_processReadBuffers])
		return;

#ifdef FD_COPY
197
198
199
200
201
202
203
204

205
206
207
208
209
210
211
199
200
201
202
203
204
205

206
207
208
209
210
211
212
213







-
+







	timeout.tv_sec = (time_t)timeInterval;
#else
	timeout.tv_sec = (long)timeInterval;
#endif
	timeout.tv_usec = (int)((timeInterval - timeout.tv_sec) * 1000000);

#ifdef OF_AMIGAOS
	if ((cancelSignal = AllocSignal(-1)) == (ULONG)-1)
	if ((cancelSignal = AllocSignal(-1)) == (BYTE)-1)
		@throw [OFObserveFailedException exceptionWithObserver: self
								 errNo: EAGAIN];

	execSignalMask = _execSignalMask | (1ul << cancelSignal);

	Forbid();