Differences From Artifact [331bf675cd]:
- File
src/OFKernelEventObserver_select.m
— part of check-in
[220513a3f5]
at
2015-05-09 18:13:19
on branch trunk
— More OFKernelEventObserver refactoring
This was necessary because select(), poll() and kevent() on FreeBSD and
OS X would sometimes return 0 events, even if there are some, and
sometimes return the correct number of events that were pending, meaning
the number of events returned is unreliable. To make things worse,
whether it returns 0 or the number of events that were pending is
completely non-deterministic on both FreeBSD and OS X (running the same
tests multiple times in a row would make it sometimes work and sometimes
fail).In order to prevent code from depending on the return value of
-[observeForTimeInterval:] (which would depend on select(), poll() and
kevent() returning the correct number), OFKernelObserver no longer
returns whether there were pending events. It is expected that
-[observe] or -[observeForTimeInterval:] is just called in a loop as
long as events should be handled.The tests have been changed as well to reflect this. What they do now is
set a deadline and call -[observeForTimeInterval:] with a small timeout
in a loop until the deadline is reached or all events have been handled.Note: DragonFlyBSD has not been tested, but will most likely behave like
FreeBSD and OS X. (user: js, size: 4581) [annotate] [blame] [check-ins using]
To Artifact [69ccd8df63]:
- File src/OFKernelEventObserver_select.m — part of check-in [a54a47a4c3] at 2015-05-16 15:16:11 on branch trunk — OFKernelEventObserver_select: Ensure fd >= 0 (user: js, size: 4633) [annotate] [blame] [check-ins using]
︙ | |||
59 60 61 62 63 64 65 | 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 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | - + - + - + - + | return self; } - (void)OF_addObjectForReading: (id)object { int fd = [object fileDescriptorForReading]; |
︙ | |||
173 174 175 176 177 178 179 | 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | - + + - + + | #endif } objects = [_readObjects objects]; count = [_readObjects count]; for (i = 0; i < count; i++) { |