24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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
72
73
74
75
76
77
78
79
80
81
82
83
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
#include <sys/time.h>
#import "OFKernelEventObserver.h"
#import "OFKernelEventObserver+Private.h"
#import "OFKernelEventObserver_select.h"
#import "OFArray.h"
#import "OFOutOfRangeException.h"
#import "socket_helpers.h"
@implementation OFKernelEventObserver_select
- init
{
self = [super init];
FD_ZERO(&_readFDs);
FD_ZERO(&_writeFDs);
FD_SET(_cancelFD[0], &_readFDs);
return self;
}
- (void)OF_addFileDescriptorForReading: (int)fd
{
if (fd >= FD_SETSIZE)
@throw [OFOutOfRangeException exception];
FD_SET(fd, &_readFDs);
}
- (void)OF_addFileDescriptorForWriting: (int)fd
{
if (fd >= FD_SETSIZE)
@throw [OFOutOfRangeException exception];
FD_SET(fd, &_writeFDs);
}
- (void)OF_removeFileDescriptorForReading: (int)fd
{
if (fd >= FD_SETSIZE)
@throw [OFOutOfRangeException exception];
FD_CLR(fd, &_readFDs);
}
- (void)OF_removeFileDescriptorForWriting: (int)fd
{
if (fd >= FD_SETSIZE)
@throw [OFOutOfRangeException exception];
FD_CLR(fd, &_writeFDs);
}
- (bool)observeForTimeInterval: (of_time_interval_t)timeInterval
{
void *pool = objc_autoreleasePoolPush();
id const *objects;
|