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