29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#import "OFArray.h"
#import "OFMapTable.h"
#import "OFNull.h"
#import "OFInitializationFailedException.h"
#import "OFObserveFailedException.h"
#define EVENTLIST_SIZE 64
static const OFMapTableFunctions mapFunctions = { NULL };
@implementation OFEpollKernelEventObserver
- (instancetype)init
{
self = [super init];
|
|
|
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#import "OFArray.h"
#import "OFMapTable.h"
#import "OFNull.h"
#import "OFInitializationFailedException.h"
#import "OFObserveFailedException.h"
#define eventListSize 64
static const OFMapTableFunctions mapFunctions = { NULL };
@implementation OFEpollKernelEventObserver
- (instancetype)init
{
self = [super init];
|
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
|
[super removeObjectForWriting: object];
}
- (void)observeForTimeInterval: (OFTimeInterval)timeInterval
{
OFNull *nullObject = [OFNull null];
struct epoll_event eventList[EVENTLIST_SIZE];
int events;
if ([self of_processReadBuffers])
return;
events = epoll_wait(_epfd, eventList, EVENTLIST_SIZE,
(timeInterval != -1 ? timeInterval * 1000 : -1));
if (events < 0)
@throw [OFObserveFailedException exceptionWithObserver: self
errNo: errno];
for (int i = 0; i < events; i++) {
|
|
|
|
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
|
[super removeObjectForWriting: object];
}
- (void)observeForTimeInterval: (OFTimeInterval)timeInterval
{
OFNull *nullObject = [OFNull null];
struct epoll_event eventList[eventListSize];
int events;
if ([self of_processReadBuffers])
return;
events = epoll_wait(_epfd, eventList, eventListSize,
(timeInterval != -1 ? timeInterval * 1000 : -1));
if (events < 0)
@throw [OFObserveFailedException exceptionWithObserver: self
errNo: errno];
for (int i = 0; i < events; i++) {
|