| Line | Source Code | Coverage |
|---|
| 1 | | - |
| 2 | | - |
| 3 | | - |
| 4 | | - |
| 5 | | - |
| 6 | | - |
| 7 | QEventDispatcherUNIXPrivate::QEventDispatcherUNIXPrivate() | - |
| 8 | { | - |
| 9 | extern Qt::HANDLE qt_application_thread_id; | - |
| 10 | mainThread = (QThread::currentThreadId() == qt_application_thread_id); | - |
| 11 | bool pipefail = false; | - |
| 12 | if (qt_safe_pipe(thread_pipe, 04000) == -1) { never evaluated: qt_safe_pipe(thread_pipe, 04000) == -1 | 0 |
| 13 | perror("QEventDispatcherUNIXPrivate(): Unable to create thread pipe"); | - |
| 14 | pipefail = true; | - |
| 15 | } | 0 |
| 16 | | - |
| 17 | | - |
| 18 | if (pipefail) never evaluated: pipefail | 0 |
| 19 | QMessageLogger("kernel/qeventdispatcher_unix.cpp", 137, __PRETTY_FUNCTION__).fatal("QEventDispatcherUNIXPrivate(): Can not continue without a thread pipe"); never executed: QMessageLogger("kernel/qeventdispatcher_unix.cpp", 137, __PRETTY_FUNCTION__).fatal("QEventDispatcherUNIXPrivate(): Can not continue without a thread pipe"); | 0 |
| 20 | | - |
| 21 | sn_highest = -1; | - |
| 22 | | - |
| 23 | interrupt = false; | - |
| 24 | } | 0 |
| 25 | | - |
| 26 | QEventDispatcherUNIXPrivate::~QEventDispatcherUNIXPrivate() | - |
| 27 | { | - |
| 28 | close(thread_pipe[0]); | - |
| 29 | close(thread_pipe[1]); | - |
| 30 | | - |
| 31 | | - |
| 32 | | - |
| 33 | qDeleteAll(timerList); | - |
| 34 | } | 0 |
| 35 | | - |
| 36 | int QEventDispatcherUNIXPrivate::doSelect(QEventLoop::ProcessEventsFlags flags, timeval *timeout) | - |
| 37 | { | - |
| 38 | QEventDispatcherUNIX * const q = q_func(); | - |
| 39 | | - |
| 40 | | - |
| 41 | timerList.updateCurrentTime(); | - |
| 42 | | - |
| 43 | int nsel; | - |
| 44 | do { | - |
| 45 | | - |
| 46 | int highest = 0; | - |
| 47 | if (! (flags & QEventLoop::ExcludeSocketNotifiers) && (sn_highest >= 0)) { never evaluated: ! (flags & QEventLoop::ExcludeSocketNotifiers) never evaluated: (sn_highest >= 0) | 0 |
| 48 | | - |
| 49 | sn_vec[0].select_fds = sn_vec[0].enabled_fds; | - |
| 50 | sn_vec[1].select_fds = sn_vec[1].enabled_fds; | - |
| 51 | sn_vec[2].select_fds = sn_vec[2].enabled_fds; | - |
| 52 | highest = sn_highest; | - |
| 53 | } else { | 0 |
| 54 | do { int __d0, __d1; __asm__ __volatile__ ("cld; rep; " "stosq" : "=c" (__d0), "=D" (__d1) : "a" (0), "0" (sizeof (fd_set) / sizeof (__fd_mask)), "1" (&((&sn_vec[0].select_fds)->fds_bits)[0]) : "memory"); } while (0); | 0 |
| 55 | do { int __d0, __d1; __asm__ __volatile__ ("cld; rep; " "stosq" : "=c" (__d0), "=D" (__d1) : "a" (0), "0" (sizeof (fd_set) / sizeof (__fd_mask)), "1" (&((&sn_vec[1].select_fds)->fds_bits)[0]) : "memory"); } while (0); | 0 |
| 56 | do { int __d0, __d1; __asm__ __volatile__ ("cld; rep; " "stosq" : "=c" (__d0), "=D" (__d1) : "a" (0), "0" (sizeof (fd_set) / sizeof (__fd_mask)), "1" (&((&sn_vec[2].select_fds)->fds_bits)[0]) : "memory"); } while (0); | 0 |
| 57 | } | 0 |
| 58 | | - |
| 59 | int wakeUpFd = initThreadWakeUp(); | - |
| 60 | highest = qMax(highest, wakeUpFd); | - |
| 61 | | - |
| 62 | nsel = q->select(highest + 1, | - |
| 63 | &sn_vec[0].select_fds, | - |
| 64 | &sn_vec[1].select_fds, | - |
| 65 | &sn_vec[2].select_fds, | - |
| 66 | timeout); | - |
| 67 | } while (nsel == -1 && ((*__errno_location ()) == 4 || (*__errno_location ()) == 11)); never evaluated: nsel == -1 never evaluated: (*__errno_location ()) == 4 never evaluated: (*__errno_location ()) == 11 | 0 |
| 68 | | - |
| 69 | if (nsel == -1) { never evaluated: nsel == -1 | 0 |
| 70 | if ((*__errno_location ()) == 9) { never evaluated: (*__errno_location ()) == 9 | 0 |
| 71 | | - |
| 72 | | - |
| 73 | fd_set fdset; | - |
| 74 | timeval tm; | - |
| 75 | tm.tv_sec = tm.tv_usec = 0l; | - |
| 76 | | - |
| 77 | for (int type = 0; type < 3; ++type) { never evaluated: type < 3 | 0 |
| 78 | QSockNotType::List &list = sn_vec[type].list; | - |
| 79 | if (list.size() == 0) never evaluated: list.size() == 0 | 0 |
| 80 | continue; never executed: continue; | 0 |
| 81 | | - |
| 82 | for (int i = 0; i < list.size(); ++i) { never evaluated: i < list.size() | 0 |
| 83 | QSockNot *sn = list[i]; | - |
| 84 | | - |
| 85 | do { int __d0, __d1; __asm__ __volatile__ ("cld; rep; " "stosq" : "=c" (__d0), "=D" (__d1) : "a" (0), "0" (sizeof (fd_set) / sizeof (__fd_mask)), "1" (&((&fdset)->fds_bits)[0]) : "memory"); } while (0); | 0 |
| 86 | (((&fdset)->fds_bits)[((sn->fd) / (8 * (int) sizeof (__fd_mask)))] |= ((__fd_mask) 1 << ((sn->fd) % (8 * (int) sizeof (__fd_mask))))); | - |
| 87 | | - |
| 88 | int ret = -1; | - |
| 89 | do { | - |
| 90 | switch (type) { | - |
| 91 | case 0: | - |
| 92 | ret = select(sn->fd + 1, &fdset, 0, 0, &tm); | - |
| 93 | break; | 0 |
| 94 | case 1: | - |
| 95 | ret = select(sn->fd + 1, 0, &fdset, 0, &tm); | - |
| 96 | break; | 0 |
| 97 | case 2: | - |
| 98 | ret = select(sn->fd + 1, 0, 0, &fdset, &tm); | - |
| 99 | break; | 0 |
| 100 | } | - |
| 101 | } while (ret == -1 && ((*__errno_location ()) == 4 || (*__errno_location ()) == 11)); never evaluated: ret == -1 never evaluated: (*__errno_location ()) == 4 never evaluated: (*__errno_location ()) == 11 | 0 |
| 102 | | - |
| 103 | if (ret == -1 && (*__errno_location ()) == 9) { never evaluated: ret == -1 never evaluated: (*__errno_location ()) == 9 | 0 |
| 104 | | - |
| 105 | static const char *t[] = { "Read", "Write", "Exception" }; | - |
| 106 | QMessageLogger("kernel/qeventdispatcher_unix.cpp", 235, __PRETTY_FUNCTION__).warning("QSocketNotifier: Invalid socket %d and type '%s', disabling...", | - |
| 107 | sn->fd, t[type]); | - |
| 108 | sn->obj->setEnabled(false); | - |
| 109 | } | 0 |
| 110 | } | 0 |
| 111 | } | 0 |
| 112 | } else { | 0 |
| 113 | | - |
| 114 | | - |
| 115 | perror("select"); | - |
| 116 | } | 0 |
| 117 | } | - |
| 118 | | - |
| 119 | int nevents = processThreadWakeUp(nsel); | - |
| 120 | | - |
| 121 | | - |
| 122 | if (! (flags & QEventLoop::ExcludeSocketNotifiers) && nsel > 0 && sn_highest >= 0) { never evaluated: ! (flags & QEventLoop::ExcludeSocketNotifiers) never evaluated: nsel > 0 never evaluated: sn_highest >= 0 | 0 |
| 123 | | - |
| 124 | | - |
| 125 | for (int i=0; i<3; i++) { | 0 |
| 126 | QSockNotType::List &list = sn_vec[i].list; | - |
| 127 | for (int j = 0; j < list.size(); ++j) { never evaluated: j < list.size() | 0 |
| 128 | QSockNot *sn = list[j]; | - |
| 129 | if (((((&sn_vec[i].select_fds)->fds_bits)[((sn->fd) / (8 * (int) sizeof (__fd_mask)))] & ((__fd_mask) 1 << ((sn->fd) % (8 * (int) sizeof (__fd_mask))))) != 0)) never evaluated: ((((&sn_vec[i].select_fds)->fds_bits)[((sn->fd) / (8 * (int) sizeof (__fd_mask)))] & ((__fd_mask) 1 << ((sn->fd) % (8 * (int) sizeof (__fd_mask))))) != 0) | 0 |
| 130 | q->setSocketNotifierPending(sn->obj); never executed: q->setSocketNotifierPending(sn->obj); | 0 |
| 131 | } | 0 |
| 132 | } | 0 |
| 133 | } | 0 |
| 134 | return (nevents + q->activateSocketNotifiers()); never executed: return (nevents + q->activateSocketNotifiers()); | 0 |
| 135 | } | - |
| 136 | | - |
| 137 | int QEventDispatcherUNIXPrivate::initThreadWakeUp() | - |
| 138 | { | - |
| 139 | (((&sn_vec[0].select_fds)->fds_bits)[((thread_pipe[0]) / (8 * (int) sizeof (__fd_mask)))] |= ((__fd_mask) 1 << ((thread_pipe[0]) % (8 * (int) sizeof (__fd_mask))))); | - |
| 140 | return thread_pipe[0]; never executed: return thread_pipe[0]; | 0 |
| 141 | } | - |
| 142 | | - |
| 143 | int QEventDispatcherUNIXPrivate::processThreadWakeUp(int nsel) | - |
| 144 | { | - |
| 145 | if (nsel > 0 && ((((&sn_vec[0].select_fds)->fds_bits)[((thread_pipe[0]) / (8 * (int) sizeof (__fd_mask)))] & ((__fd_mask) 1 << ((thread_pipe[0]) % (8 * (int) sizeof (__fd_mask))))) != 0)) { never evaluated: nsel > 0 never evaluated: ((((&sn_vec[0].select_fds)->fds_bits)[((thread_pipe[0]) / (8 * (int) sizeof (__fd_mask)))] & ((__fd_mask) 1 << ((thread_pipe[0]) % (8 * (int) sizeof (__fd_mask))))) != 0) | 0 |
| 146 | | - |
| 147 | | - |
| 148 | | - |
| 149 | | - |
| 150 | | - |
| 151 | | - |
| 152 | | - |
| 153 | char c[16]; | - |
| 154 | while (::read(thread_pipe[0], c, sizeof(c)) > 0) never evaluated: ::read(thread_pipe[0], c, sizeof(c)) > 0 | 0 |
| 155 | ; | 0 |
| 156 | | - |
| 157 | if (!wakeUps.testAndSetRelease(1, 0)) { never evaluated: !wakeUps.testAndSetRelease(1, 0) | 0 |
| 158 | | - |
| 159 | QMessageLogger("kernel/qeventdispatcher_unix.cpp", 288, __PRETTY_FUNCTION__).warning("QEventDispatcherUNIX: internal error, wakeUps.testAndSetRelease(1, 0) failed!"); | - |
| 160 | } | 0 |
| 161 | return 1; never executed: return 1; | 0 |
| 162 | } | - |
| 163 | return 0; never executed: return 0; | 0 |
| 164 | } | - |
| 165 | | - |
| 166 | QEventDispatcherUNIX::QEventDispatcherUNIX(QObject *parent) | - |
| 167 | : QAbstractEventDispatcher(*new QEventDispatcherUNIXPrivate, parent) | - |
| 168 | { } | 0 |
| 169 | | - |
| 170 | QEventDispatcherUNIX::QEventDispatcherUNIX(QEventDispatcherUNIXPrivate &dd, QObject *parent) | - |
| 171 | : QAbstractEventDispatcher(dd, parent) | - |
| 172 | { } | 0 |
| 173 | | - |
| 174 | QEventDispatcherUNIX::~QEventDispatcherUNIX() | - |
| 175 | { | - |
| 176 | QEventDispatcherUNIXPrivate * const d = d_func(); | - |
| 177 | d->threadData->eventDispatcher = 0; | - |
| 178 | } | 0 |
| 179 | | - |
| 180 | int QEventDispatcherUNIX::select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, | - |
| 181 | timeval *timeout) | - |
| 182 | { | - |
| 183 | return qt_safe_select(nfds, readfds, writefds, exceptfds, timeout); never executed: return qt_safe_select(nfds, readfds, writefds, exceptfds, timeout); | 0 |
| 184 | } | - |
| 185 | | - |
| 186 | | - |
| 187 | | - |
| 188 | | - |
| 189 | void QEventDispatcherUNIX::registerTimer(int timerId, int interval, Qt::TimerType timerType, QObject *obj) | - |
| 190 | { | - |
| 191 | QEventDispatcherUNIXPrivate * const d = d_func(); | - |
| 192 | d->timerList.registerTimer(timerId, interval, timerType, obj); | - |
| 193 | } | 0 |
| 194 | | - |
| 195 | | - |
| 196 | | - |
| 197 | | - |
| 198 | bool QEventDispatcherUNIX::unregisterTimer(int timerId) | - |
| 199 | { | - |
| 200 | QEventDispatcherUNIXPrivate * const d = d_func(); | - |
| 201 | return d->timerList.unregisterTimer(timerId); never executed: return d->timerList.unregisterTimer(timerId); | 0 |
| 202 | } | - |
| 203 | | - |
| 204 | | - |
| 205 | | - |
| 206 | | - |
| 207 | bool QEventDispatcherUNIX::unregisterTimers(QObject *object) | - |
| 208 | { | - |
| 209 | QEventDispatcherUNIXPrivate * const d = d_func(); | - |
| 210 | return d->timerList.unregisterTimers(object); never executed: return d->timerList.unregisterTimers(object); | 0 |
| 211 | } | - |
| 212 | | - |
| 213 | QList<QEventDispatcherUNIX::TimerInfo> | - |
| 214 | QEventDispatcherUNIX::registeredTimers(QObject *object) const | - |
| 215 | { | - |
| 216 | if (!object) { | 0 |
| 217 | QMessageLogger("kernel/qeventdispatcher_unix.cpp", 376, __PRETTY_FUNCTION__).warning("QEventDispatcherUNIX:registeredTimers: invalid argument"); | - |
| 218 | return QList<TimerInfo>(); never executed: return QList<TimerInfo>(); | 0 |
| 219 | } | - |
| 220 | | - |
| 221 | const QEventDispatcherUNIXPrivate * const d = d_func(); | - |
| 222 | return d->timerList.registeredTimers(object); never executed: return d->timerList.registeredTimers(object); | 0 |
| 223 | } | - |
| 224 | | - |
| 225 | | - |
| 226 | | - |
| 227 | | - |
| 228 | QSockNotType::QSockNotType() | - |
| 229 | { | - |
| 230 | do { int __d0, __d1; __asm__ __volatile__ ("cld; rep; " "stosq" : "=c" (__d0), "=D" (__d1) : "a" (0), "0" (sizeof (fd_set) / sizeof (__fd_mask)), "1" (&((&select_fds)->fds_bits)[0]) : "memory"); } while (0); | 0 |
| 231 | do { int __d0, __d1; __asm__ __volatile__ ("cld; rep; " "stosq" : "=c" (__d0), "=D" (__d1) : "a" (0), "0" (sizeof (fd_set) / sizeof (__fd_mask)), "1" (&((&enabled_fds)->fds_bits)[0]) : "memory"); } while (0); | 0 |
| 232 | do { int __d0, __d1; __asm__ __volatile__ ("cld; rep; " "stosq" : "=c" (__d0), "=D" (__d1) : "a" (0), "0" (sizeof (fd_set) / sizeof (__fd_mask)), "1" (&((&pending_fds)->fds_bits)[0]) : "memory"); } while (0); | 0 |
| 233 | } | 0 |
| 234 | | - |
| 235 | QSockNotType::~QSockNotType() | - |
| 236 | { | - |
| 237 | for (int i = 0; i < list.size(); ++i) never evaluated: i < list.size() | 0 |
| 238 | delete list[i]; never executed: delete list[i]; | 0 |
| 239 | } | 0 |
| 240 | | - |
| 241 | | - |
| 242 | | - |
| 243 | | - |
| 244 | | - |
| 245 | void QEventDispatcherUNIX::registerSocketNotifier(QSocketNotifier *notifier) | - |
| 246 | { | - |
| 247 | qt_noop(); | - |
| 248 | int sockfd = notifier->socket(); | - |
| 249 | int type = notifier->type(); | - |
| 250 | QEventDispatcherUNIXPrivate * const d = d_func(); | - |
| 251 | QSockNotType::List &list = d->sn_vec[type].list; | - |
| 252 | fd_set *fds = &d->sn_vec[type].enabled_fds; | - |
| 253 | QSockNot *sn; | - |
| 254 | | - |
| 255 | sn = new QSockNot; | - |
| 256 | sn->obj = notifier; | - |
| 257 | sn->fd = sockfd; | - |
| 258 | sn->queue = &d->sn_vec[type].pending_fds; | - |
| 259 | | - |
| 260 | int i; | - |
| 261 | for (i = 0; i < list.size(); ++i) { never evaluated: i < list.size() | 0 |
| 262 | QSockNot *p = list[i]; | - |
| 263 | if (p->fd < sockfd) never evaluated: p->fd < sockfd | 0 |
| 264 | break; | 0 |
| 265 | if (p->fd == sockfd) { never evaluated: p->fd == sockfd | 0 |
| 266 | static const char *t[] = { "Read", "Write", "Exception" }; | - |
| 267 | QMessageLogger("kernel/qeventdispatcher_unix.cpp", 438, __PRETTY_FUNCTION__).warning("QSocketNotifier: Multiple socket notifiers for " | - |
| 268 | "same socket %d and type %s", sockfd, t[type]); | - |
| 269 | } | 0 |
| 270 | } | 0 |
| 271 | list.insert(i, sn); | - |
| 272 | | - |
| 273 | (((fds)->fds_bits)[((sockfd) / (8 * (int) sizeof (__fd_mask)))] |= ((__fd_mask) 1 << ((sockfd) % (8 * (int) sizeof (__fd_mask))))); | - |
| 274 | d->sn_highest = qMax(d->sn_highest, sockfd); | - |
| 275 | } | 0 |
| 276 | | - |
| 277 | void QEventDispatcherUNIX::unregisterSocketNotifier(QSocketNotifier *notifier) | - |
| 278 | { | - |
| 279 | qt_noop(); | - |
| 280 | int sockfd = notifier->socket(); | - |
| 281 | int type = notifier->type(); | - |
| 282 | QEventDispatcherUNIXPrivate * const d = d_func(); | - |
| 283 | QSockNotType::List &list = d->sn_vec[type].list; | - |
| 284 | fd_set *fds = &d->sn_vec[type].enabled_fds; | - |
| 285 | QSockNot *sn = 0; | - |
| 286 | int i; | - |
| 287 | for (i = 0; i < list.size(); ++i) { never evaluated: i < list.size() | 0 |
| 288 | sn = list[i]; | - |
| 289 | if(sn->obj == notifier && sn->fd == sockfd) never evaluated: sn->obj == notifier never evaluated: sn->fd == sockfd | 0 |
| 290 | break; | 0 |
| 291 | } | 0 |
| 292 | if (i == list.size()) never evaluated: i == list.size() | 0 |
| 293 | return; | 0 |
| 294 | | - |
| 295 | (((fds)->fds_bits)[((sockfd) / (8 * (int) sizeof (__fd_mask)))] &= ~((__fd_mask) 1 << ((sockfd) % (8 * (int) sizeof (__fd_mask))))); | - |
| 296 | (((sn->queue)->fds_bits)[((sockfd) / (8 * (int) sizeof (__fd_mask)))] &= ~((__fd_mask) 1 << ((sockfd) % (8 * (int) sizeof (__fd_mask))))); | - |
| 297 | d->sn_pending_list.removeAll(sn); | - |
| 298 | list.removeAt(i); | - |
| 299 | delete sn; | - |
| 300 | | - |
| 301 | if (d->sn_highest == sockfd) { never evaluated: d->sn_highest == sockfd | 0 |
| 302 | d->sn_highest = -1; | - |
| 303 | for (int i=0; i<3; i++) { | 0 |
| 304 | if (!d->sn_vec[i].list.isEmpty()) never evaluated: !d->sn_vec[i].list.isEmpty() | 0 |
| 305 | d->sn_highest = qMax(d->sn_highest, | 0 |
| 306 | d->sn_vec[i].list[0]->fd); never executed: d->sn_highest = qMax(d->sn_highest, d->sn_vec[i].list[0]->fd); | 0 |
| 307 | } | 0 |
| 308 | } | 0 |
| 309 | } | 0 |
| 310 | | - |
| 311 | void QEventDispatcherUNIX::setSocketNotifierPending(QSocketNotifier *notifier) | - |
| 312 | { | - |
| 313 | qt_noop(); | - |
| 314 | int sockfd = notifier->socket(); | - |
| 315 | int type = notifier->type(); | - |
| 316 | QEventDispatcherUNIXPrivate * const d = d_func(); | - |
| 317 | QSockNotType::List &list = d->sn_vec[type].list; | - |
| 318 | QSockNot *sn = 0; | - |
| 319 | int i; | - |
| 320 | for (i = 0; i < list.size(); ++i) { never evaluated: i < list.size() | 0 |
| 321 | sn = list[i]; | - |
| 322 | if(sn->obj == notifier && sn->fd == sockfd) never evaluated: sn->obj == notifier never evaluated: sn->fd == sockfd | 0 |
| 323 | break; | 0 |
| 324 | } | 0 |
| 325 | if (i == list.size()) never evaluated: i == list.size() | 0 |
| 326 | return; | 0 |
| 327 | | - |
| 328 | | - |
| 329 | | - |
| 330 | | - |
| 331 | | - |
| 332 | | - |
| 333 | | - |
| 334 | if (! ((((sn->queue)->fds_bits)[((sn->fd) / (8 * (int) sizeof (__fd_mask)))] & ((__fd_mask) 1 << ((sn->fd) % (8 * (int) sizeof (__fd_mask))))) != 0)) { never evaluated: ! ((((sn->queue)->fds_bits)[((sn->fd) / (8 * (int) sizeof (__fd_mask)))] & ((__fd_mask) 1 << ((sn->fd) % (8 * (int) sizeof (__fd_mask))))) != 0) | 0 |
| 335 | if (d->sn_pending_list.isEmpty()) { never evaluated: d->sn_pending_list.isEmpty() | 0 |
| 336 | d->sn_pending_list.append(sn); | - |
| 337 | } else { | 0 |
| 338 | d->sn_pending_list.insert((qrand() & 0xff) % | - |
| 339 | (d->sn_pending_list.size()+1), sn); | - |
| 340 | } | 0 |
| 341 | (((sn->queue)->fds_bits)[((sn->fd) / (8 * (int) sizeof (__fd_mask)))] |= ((__fd_mask) 1 << ((sn->fd) % (8 * (int) sizeof (__fd_mask))))); | - |
| 342 | } | 0 |
| 343 | } | 0 |
| 344 | | - |
| 345 | int QEventDispatcherUNIX::activateTimers() | - |
| 346 | { | - |
| 347 | qt_noop(); | - |
| 348 | QEventDispatcherUNIXPrivate * const d = d_func(); | - |
| 349 | return d->timerList.activateTimers(); never executed: return d->timerList.activateTimers(); | 0 |
| 350 | } | - |
| 351 | | - |
| 352 | int QEventDispatcherUNIX::activateSocketNotifiers() | - |
| 353 | { | - |
| 354 | QEventDispatcherUNIXPrivate * const d = d_func(); | - |
| 355 | if (d->sn_pending_list.isEmpty()) never evaluated: d->sn_pending_list.isEmpty() | 0 |
| 356 | return 0; never executed: return 0; | 0 |
| 357 | | - |
| 358 | | - |
| 359 | int n_act = 0; | - |
| 360 | QEvent event(QEvent::SockAct); | - |
| 361 | while (!d->sn_pending_list.isEmpty()) { never evaluated: !d->sn_pending_list.isEmpty() | 0 |
| 362 | QSockNot *sn = d->sn_pending_list.takeFirst(); | - |
| 363 | if (((((sn->queue)->fds_bits)[((sn->fd) / (8 * (int) sizeof (__fd_mask)))] & ((__fd_mask) 1 << ((sn->fd) % (8 * (int) sizeof (__fd_mask))))) != 0)) { never evaluated: ((((sn->queue)->fds_bits)[((sn->fd) / (8 * (int) sizeof (__fd_mask)))] & ((__fd_mask) 1 << ((sn->fd) % (8 * (int) sizeof (__fd_mask))))) != 0) | 0 |
| 364 | (((sn->queue)->fds_bits)[((sn->fd) / (8 * (int) sizeof (__fd_mask)))] &= ~((__fd_mask) 1 << ((sn->fd) % (8 * (int) sizeof (__fd_mask))))); | - |
| 365 | QCoreApplication::sendEvent(sn->obj, &event); | - |
| 366 | ++n_act; | - |
| 367 | } | 0 |
| 368 | } | 0 |
| 369 | return n_act; never executed: return n_act; | 0 |
| 370 | } | - |
| 371 | | - |
| 372 | bool QEventDispatcherUNIX::processEvents(QEventLoop::ProcessEventsFlags flags) | - |
| 373 | { | - |
| 374 | QEventDispatcherUNIXPrivate * const d = d_func(); | - |
| 375 | d->interrupt = false; | - |
| 376 | | - |
| 377 | | - |
| 378 | awake(); | - |
| 379 | QCoreApplicationPrivate::sendPostedEvents(0, 0, d->threadData); | - |
| 380 | | - |
| 381 | int nevents = 0; | - |
| 382 | const bool canWait = (d->threadData->canWait never evaluated: d->threadData->canWait | 0 |
| 383 | && !d->interrupt never evaluated: !d->interrupt | 0 |
| 384 | && (flags & QEventLoop::WaitForMoreEvents)); never evaluated: (flags & QEventLoop::WaitForMoreEvents) | 0 |
| 385 | | - |
| 386 | if (canWait) | 0 |
| 387 | aboutToBlock(); never executed: aboutToBlock(); | 0 |
| 388 | | - |
| 389 | if (!d->interrupt) { never evaluated: !d->interrupt | 0 |
| 390 | | - |
| 391 | timeval *tm = 0; | - |
| 392 | timeval wait_tm = { 0l, 0l }; | - |
| 393 | if (!(flags & QEventLoop::X11ExcludeTimers)) { never evaluated: !(flags & QEventLoop::X11ExcludeTimers) | 0 |
| 394 | if (d->timerList.timerWait(wait_tm)) never evaluated: d->timerList.timerWait(wait_tm) | 0 |
| 395 | tm = &wait_tm; never executed: tm = &wait_tm; | 0 |
| 396 | } | 0 |
| 397 | | - |
| 398 | if (!canWait) { never evaluated: !canWait | 0 |
| 399 | if (!tm) | 0 |
| 400 | tm = &wait_tm; never executed: tm = &wait_tm; | 0 |
| 401 | | - |
| 402 | | - |
| 403 | tm->tv_sec = 0l; | - |
| 404 | tm->tv_usec = 0l; | - |
| 405 | } | 0 |
| 406 | | - |
| 407 | nevents = d->doSelect(flags, tm); | - |
| 408 | | - |
| 409 | | - |
| 410 | if (! (flags & QEventLoop::X11ExcludeTimers)) { never evaluated: ! (flags & QEventLoop::X11ExcludeTimers) | 0 |
| 411 | nevents += activateTimers(); | - |
| 412 | } | 0 |
| 413 | } | 0 |
| 414 | | - |
| 415 | return (nevents > 0); never executed: return (nevents > 0); | 0 |
| 416 | } | - |
| 417 | | - |
| 418 | bool QEventDispatcherUNIX::hasPendingEvents() | - |
| 419 | { | - |
| 420 | extern uint qGlobalPostedEventsCount(); | - |
| 421 | return qGlobalPostedEventsCount(); never executed: return qGlobalPostedEventsCount(); | 0 |
| 422 | } | - |
| 423 | | - |
| 424 | int QEventDispatcherUNIX::remainingTime(int timerId) | - |
| 425 | { | - |
| 426 | | - |
| 427 | | - |
| 428 | | - |
| 429 | | - |
| 430 | | - |
| 431 | | - |
| 432 | | - |
| 433 | QEventDispatcherUNIXPrivate * const d = d_func(); | - |
| 434 | return d->timerList.timerRemainingTime(timerId); never executed: return d->timerList.timerRemainingTime(timerId); | 0 |
| 435 | } | - |
| 436 | | - |
| 437 | void QEventDispatcherUNIX::wakeUp() | - |
| 438 | { | - |
| 439 | QEventDispatcherUNIXPrivate * const d = d_func(); | - |
| 440 | if (d->wakeUps.testAndSetAcquire(0, 1)) { never evaluated: d->wakeUps.testAndSetAcquire(0, 1) | 0 |
| 441 | char c = 0; | - |
| 442 | qt_safe_write( d->thread_pipe[1], &c, 1 ); | - |
| 443 | } | 0 |
| 444 | } | 0 |
| 445 | | - |
| 446 | void QEventDispatcherUNIX::interrupt() | - |
| 447 | { | - |
| 448 | QEventDispatcherUNIXPrivate * const d = d_func(); | - |
| 449 | d->interrupt = true; | - |
| 450 | wakeUp(); | - |
| 451 | } | 0 |
| 452 | | - |
| 453 | void QEventDispatcherUNIX::flush() | - |
| 454 | { } | - |
| 455 | | - |
| 456 | | - |
| 457 | | - |
| | |