diff options
author | Kurt Korbatits <kurt.korbatits@nokia.com> | 2010-06-24 22:46:13 (GMT) |
---|---|---|
committer | Kurt Korbatits <kurt.korbatits@nokia.com> | 2010-06-24 22:46:13 (GMT) |
commit | a6837b3445ba4680b5c13641c9ecd24d36693a1f (patch) | |
tree | 181603815eeacf791aee98d8ec1f0d1d22033fb4 /src | |
parent | a67e9a9a0d0e335db2f7b7232c6c7ec42750533c (diff) | |
parent | 5dd9ac97fbe716699d832853bd61627a9f7885a8 (diff) | |
download | Qt-a6837b3445ba4680b5c13641c9ecd24d36693a1f.zip Qt-a6837b3445ba4680b5c13641c9ecd24d36693a1f.tar.gz Qt-a6837b3445ba4680b5c13641c9ecd24d36693a1f.tar.bz2 |
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/qt-multimedia-staging into 4.6
Diffstat (limited to 'src')
-rw-r--r-- | src/3rdparty/harfbuzz/src/harfbuzz-global.h | 2 | ||||
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_symbian.cpp | 141 | ||||
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_symbian_p.h | 25 |
3 files changed, 48 insertions, 120 deletions
diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-global.h b/src/3rdparty/harfbuzz/src/harfbuzz-global.h index 5b2b679..bccd6a2 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-global.h +++ b/src/3rdparty/harfbuzz/src/harfbuzz-global.h @@ -39,7 +39,7 @@ #define HB_END_HEADER /* nothing */ #endif -#if defined(__GNUC__) || defined(__ARMCC__) || defined(__CC_ARM) || defined(_MSC_VER) +#if defined(__GNUC__) || defined(_MSC_VER) #define HB_USE_PACKED_STRUCTS #endif diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp index 75b7619..826caf2 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian.cpp +++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp @@ -100,44 +100,25 @@ static inline int qt_socket_select(int nfds, fd_set *readfds, fd_set *writefds, class QSelectMutexGrabber { public: - QSelectMutexGrabber(int fd, QMutex *threadMutex, QMutex *selectCallMutex) - : m_threadMutex(threadMutex), m_selectCallMutex(selectCallMutex), bHasThreadLock(false) + QSelectMutexGrabber(int fd, QMutex *mutex) + : m_mutex(mutex) { - // see if selectThread is waiting m_waitCond - // if yes ... dont write to pipe - if (m_threadMutex->tryLock()) { - bHasThreadLock = true; + if (m_mutex->tryLock()) return; - } - - // still check that SelectThread - // is in select call - if (m_selectCallMutex->tryLock()) { - m_selectCallMutex->unlock(); - - //m_threadMutex->lock(); - //bHasThreadLock = true; - return; - } - char dummy = 0; qt_pipe_write(fd, &dummy, 1); - m_threadMutex->lock(); - bHasThreadLock = true; + m_mutex->lock(); } ~QSelectMutexGrabber() { - if(bHasThreadLock) - m_threadMutex->unlock(); + m_mutex->unlock(); } private: - QMutex *m_threadMutex; - QMutex *m_selectCallMutex; - bool bHasThreadLock; + QMutex *m_mutex; }; /* @@ -409,25 +390,17 @@ void QSelectThread::run() FD_ZERO(&exceptionfds); int maxfd = 0; - { - QMutexLocker asoLocker(&m_AOStatusesMutex); - maxfd = qMax(maxfd, updateSocketSet(QSocketNotifier::Read, &readfds)); - maxfd = qMax(maxfd, updateSocketSet(QSocketNotifier::Write, &writefds)); - maxfd = qMax(maxfd, updateSocketSet(QSocketNotifier::Exception, &exceptionfds)); - maxfd = qMax(maxfd, m_pipeEnds[0]); - maxfd++; - } + maxfd = qMax(maxfd, updateSocketSet(QSocketNotifier::Read, &readfds)); + maxfd = qMax(maxfd, updateSocketSet(QSocketNotifier::Write, &writefds)); + maxfd = qMax(maxfd, updateSocketSet(QSocketNotifier::Exception, &exceptionfds)); + maxfd = qMax(maxfd, m_pipeEnds[0]); + maxfd++; FD_SET(m_pipeEnds[0], &readfds); int ret; int savedSelectErrno; - { - // helps fighting the race condition between - // selctthread and new socket requests (cancel, restart ...) - QMutexLocker locker(&m_selectCallMutex); - ret = qt_socket_select(maxfd, &readfds, &writefds, &exceptionfds, 0); - } + ret = qt_socket_select(maxfd, &readfds, &writefds, &exceptionfds, 0); savedSelectErrno = errno; char buffer; @@ -461,42 +434,40 @@ void QSelectThread::run() FD_ZERO(&readfds); FD_ZERO(&writefds); FD_ZERO(&exceptionfds); - { - QMutexLocker asoLocker(&m_AOStatusesMutex); - for (QHash<QSocketNotifier *, TRequestStatus *>::const_iterator i = m_AOStatuses.begin(); - i != m_AOStatuses.end(); ++i) { + for (QHash<QSocketNotifier *, TRequestStatus *>::const_iterator i = m_AOStatuses.begin(); + i != m_AOStatuses.end(); ++i) { - fd_set onefds; - FD_ZERO(&onefds); - FD_SET(i.key()->socket(), &onefds); + fd_set onefds; + FD_ZERO(&onefds); + FD_SET(i.key()->socket(), &onefds); - fd_set excfds; - FD_ZERO(&excfds); - FD_SET(i.key()->socket(), &excfds); + fd_set excfds; + FD_ZERO(&excfds); + FD_SET(i.key()->socket(), &excfds); - maxfd = i.key()->socket() + 1; + maxfd = i.key()->socket() + 1; - struct timeval timeout; - timeout.tv_sec = 0; - timeout.tv_usec = 0; + struct timeval timeout; + timeout.tv_sec = 0; + timeout.tv_usec = 0; - ret = 0; + ret = 0; - if(i.key()->type() == QSocketNotifier::Read) { - ret = ::select(maxfd, &onefds, 0, &excfds, &timeout); - if(ret != 0) FD_SET(i.key()->socket(), &readfds); - } else if(i.key()->type() == QSocketNotifier::Write) { - ret = ::select(maxfd, 0, &onefds, &excfds, &timeout); - if(ret != 0) FD_SET(i.key()->socket(), &writefds); - } + if(i.key()->type() == QSocketNotifier::Read) { + ret = ::select(maxfd, &onefds, 0, &excfds, &timeout); + if(ret != 0) FD_SET(i.key()->socket(), &readfds); + } else if(i.key()->type() == QSocketNotifier::Write) { + ret = ::select(maxfd, 0, &onefds, &excfds, &timeout); + if(ret != 0) FD_SET(i.key()->socket(), &writefds); + } - } // end for + } // end for + + // traversed all, so update + updateActivatedNotifiers(QSocketNotifier::Exception, &exceptionfds); + updateActivatedNotifiers(QSocketNotifier::Read, &readfds); + updateActivatedNotifiers(QSocketNotifier::Write, &writefds); - // traversed all, so update - updateActivatedNotifiers(QSocketNotifier::Exception, &exceptionfds); - updateActivatedNotifiers(QSocketNotifier::Read, &readfds); - updateActivatedNotifiers(QSocketNotifier::Write, &writefds); - } break; case EINTR: // Should never occur on Symbian, but this is future proof! default: @@ -505,12 +476,9 @@ void QSelectThread::run() break; } } else { - { - QMutexLocker asoLocker(&m_AOStatusesMutex); - updateActivatedNotifiers(QSocketNotifier::Exception, &exceptionfds); - updateActivatedNotifiers(QSocketNotifier::Read, &readfds); - updateActivatedNotifiers(QSocketNotifier::Write, &writefds); - } + updateActivatedNotifiers(QSocketNotifier::Exception, &exceptionfds); + updateActivatedNotifiers(QSocketNotifier::Read, &readfds); + updateActivatedNotifiers(QSocketNotifier::Write, &writefds); } m_waitCond.wait(&m_mutex); @@ -527,42 +495,27 @@ void QSelectThread::requestSocketEvents ( QSocketNotifier *notifier, TRequestSta start(); } - QMutexLocker locker(&m_grabberMutex); + QSelectMutexGrabber lock(m_pipeEnds[1], &m_mutex); - { - // first do the thing - QMutexLocker aosLocker(&m_AOStatusesMutex); - Q_ASSERT(!m_AOStatuses.contains(notifier)); - m_AOStatuses.insert(notifier, status); - } + Q_ASSERT(!m_AOStatuses.contains(notifier)); - // and now tell it to the others - QSelectMutexGrabber lock(m_pipeEnds[1], &m_mutex, &m_selectCallMutex); + m_AOStatuses.insert(notifier, status); m_waitCond.wakeAll(); } void QSelectThread::cancelSocketEvents ( QSocketNotifier *notifier ) { - QMutexLocker locker(&m_grabberMutex); + QSelectMutexGrabber lock(m_pipeEnds[1], &m_mutex); - { - // first do the thing - QMutexLocker aosLocker(&m_AOStatusesMutex); - m_AOStatuses.remove(notifier); - } - - // and now tell it to the others - QSelectMutexGrabber lock(m_pipeEnds[1], &m_mutex, &m_selectCallMutex); + m_AOStatuses.remove(notifier); m_waitCond.wakeAll(); } void QSelectThread::restart() { - QMutexLocker locker(&m_grabberMutex); - - QSelectMutexGrabber lock(m_pipeEnds[1], &m_mutex, &m_selectCallMutex); + QSelectMutexGrabber lock(m_pipeEnds[1], &m_mutex); m_waitCond.wakeAll(); } diff --git a/src/corelib/kernel/qeventdispatcher_symbian_p.h b/src/corelib/kernel/qeventdispatcher_symbian_p.h index 68d5833..8a9c9a0 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian_p.h +++ b/src/corelib/kernel/qeventdispatcher_symbian_p.h @@ -211,31 +211,6 @@ private: QMutex m_mutex; QWaitCondition m_waitCond; bool m_quit; - - // to protect when several - // requests like: - // requestSocketEvents - // cancelSocketEvents - // kick in the same time - // all will fight for m_mutex - // - // TODO: fix more elegantely - // - QMutex m_grabberMutex; - - // this one will tell - // if selectthread is - // really in select call - // and will prevent - // writing to pipe that - // causes later in locking - // of the thread in waitcond - QMutex m_selectCallMutex; - - // Argh ... not again - // one more unprotected - // resource is m_AOStatuses - QMutex m_AOStatusesMutex; }; class Q_CORE_EXPORT CQtActiveScheduler : public CActiveScheduler |