Differences From Artifact [26ca60eaf1]:
- File
src/OFStreamObserver_poll.m
— part of check-in
[3de549d6a5]
at
2012-09-12 06:00:29
on branch trunk
— OFStreamObserver: Cancel is no event anymore.
As cancel internally was an event, -[observeWithTimeout:] returned YES
before when an observe call was canceled. Now, the number of real events
is counted and NO returned if this is 0. (user: js, size: 3648) [annotate] [blame] [check-ins using]
To Artifact [80446fffb3]:
- File src/OFStreamObserver_poll.m — part of check-in [c137da5e5b] at 2012-09-16 15:27:48 on branch trunk — Prefix all private methods with OF_. (user: js, size: 3670) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
53 54 55 56 57 58 59 | - (void)dealloc { [FDs release]; [super dealloc]; } | | | | | | | | | | | | | | | | | | | | 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 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 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | - (void)dealloc { [FDs release]; [super dealloc]; } - (void)OF_addFileDescriptor: (int)fd withEvents: (short)events { struct pollfd *FDsCArray = [FDs cArray]; size_t i, count = [FDs count]; BOOL found = NO; for (i = 0; i < count; i++) { if (FDsCArray[i].fd == fd) { FDsCArray[i].events |= events; found = YES; break; } } if (!found) { struct pollfd p = { fd, events | POLLERR, 0 }; [FDs addItem: &p]; } } - (void)OF_removeFileDescriptor: (int)fd withEvents: (short)events { struct pollfd *FDsCArray = [FDs cArray]; size_t i, nFDs = [FDs count]; for (i = 0; i < nFDs; i++) { if (FDsCArray[i].fd == fd) { FDsCArray[i].events &= ~events; if ((FDsCArray[i].events & ~POLLERR) == 0) [FDs removeItemAtIndex: i]; break; } } } - (void)OF_addFileDescriptorForReading: (int)fd { [self OF_addFileDescriptor: fd withEvents: POLLIN]; } - (void)OF_addFileDescriptorForWriting: (int)fd { [self OF_addFileDescriptor: fd withEvents: POLLOUT]; } - (void)OF_removeFileDescriptorForReading: (int)fd { [self OF_removeFileDescriptor: fd withEvents: POLLIN]; } - (void)OF_removeFileDescriptorForWriting: (int)fd { [self OF_removeFileDescriptor: fd withEvents: POLLOUT]; } - (BOOL)observeWithTimeout: (double)timeout { void *pool = objc_autoreleasePoolPush(); struct pollfd *FDsCArray; size_t i, nFDs, realEvents = 0; [self OF_processQueue]; if ([self OF_processCache]) { objc_autoreleasePoolPop(pool); return YES; } objc_autoreleasePoolPop(pool); FDsCArray = [FDs cArray]; |
︙ | ︙ |