1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
/*
* Copyright (c) 2008-2022 Jonathan Schleifer <js@nil.im>
*
* All rights reserved.
*
* This file is part of ObjFW. It may be distributed under the terms of the
* Q Public License 1.0, which can be found in the file LICENSE.QPL included in
* the packaging of this file.
*
* Alternatively, it may be distributed under the terms of the GNU General
* Public License, either version 2 or 3, which can be found in the file
* LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
* file.
*/
#include "config.h"
#include <assert.h>
#include <errno.h>
#ifdef HAVE_FCNTL_H
# include <fcntl.h>
#endif
#include "unistd_wrapper.h"
|
|
<
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
/*
* Copyright (c) 2008-2023 Jonathan Schleifer <js@nil.im>
*
* All rights reserved.
*
* This file is part of ObjFW. It may be distributed under the terms of the
* Q Public License 1.0, which can be found in the file LICENSE.QPL included in
* the packaging of this file.
*
* Alternatively, it may be distributed under the terms of the GNU General
* Public License, either version 2 or 3, which can be found in the file
* LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
* file.
*/
#include "config.h"
#include <errno.h>
#ifdef HAVE_FCNTL_H
# include <fcntl.h>
#endif
#include "unistd_wrapper.h"
|
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
|
@throw [OFObserveKernelEventsFailedException
exceptionWithObserver: self
errNo: (int)eventList[i].data];
if (eventList[i].ident == (uintptr_t)_cancelFD[0]) {
char buffer;
assert(eventList[i].filter == EVFILT_READ);
OFEnsure(read(_cancelFD[0], &buffer, 1) == 1);
continue;
}
pool = objc_autoreleasePoolPush();
|
|
|
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
|
@throw [OFObserveKernelEventsFailedException
exceptionWithObserver: self
errNo: (int)eventList[i].data];
if (eventList[i].ident == (uintptr_t)_cancelFD[0]) {
char buffer;
OFAssert(eventList[i].filter == EVFILT_READ);
OFEnsure(read(_cancelFD[0], &buffer, 1) == 1);
continue;
}
pool = objc_autoreleasePoolPush();
|
206
207
208
209
210
211
212
213
214
215
216
217
218
219
|
case EVFILT_WRITE:
if ([_delegate respondsToSelector:
@selector(objectIsReadyForWriting:)])
[_delegate objectIsReadyForWriting:
(id)eventList[i].udata];
break;
default:
assert(0);
}
objc_autoreleasePoolPop(pool);
}
}
@end
|
|
|
205
206
207
208
209
210
211
212
213
214
215
216
217
218
|
case EVFILT_WRITE:
if ([_delegate respondsToSelector:
@selector(objectIsReadyForWriting:)])
[_delegate objectIsReadyForWriting:
(id)eventList[i].udata];
break;
default:
OFAssert(0);
}
objc_autoreleasePoolPop(pool);
}
}
@end
|