ObjFW  Check-in [4504bd4141]

Overview
Comment:OFSelectKernelEventObserver: Move FD_ZERO

It was inside the #ifdef, so not being done on AmigaOS.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 4504bd4141821b1f27e5cd7ab41567c1ca7013d6e457e7912a2f67ce4dd22c9d
User & Date: js on 2020-11-29 04:02:42
Other Links: manifest | tags
Context
2020-11-29
06:11
OFOptionsParser: Fix wrong deallocation order check-in: 36d7c17c98 user: js tags: trunk
04:38
Merge trunk into 1.0 branch check-in: db2ba76342 user: js tags: 1.0
04:02
OFSelectKernelEventObserver: Move FD_ZERO check-in: 4504bd4141 user: js tags: trunk
02:44
OFKernelEventObserver: Reorder #ifdefs check-in: d76213374e user: js tags: trunk
Changes

Modified src/OFSelectKernelEventObserver.m from [63c9f7d74b] to [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

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

	@try {



#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







>
>
>









<
<







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_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
- (void)observeForTimeInterval: (of_time_interval_t)timeInterval
{
	fd_set readFDs;
	fd_set writeFDs;
	struct timeval timeout;
	int events;
#ifdef OF_AMIGAOS

	ULONG execSignalMask, cancelSignal;
#endif
	void *pool;

	if ([self of_processReadBuffers])
		return;

#ifdef FD_COPY







>
|







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;
#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
	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)
		@throw [OFObserveFailedException exceptionWithObserver: self
								 errNo: EAGAIN];

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

	Forbid();








|







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)) == (BYTE)-1)
		@throw [OFObserveFailedException exceptionWithObserver: self
								 errNo: EAGAIN];

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

	Forbid();