diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-05-25 17:39:52 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-05-25 17:39:52 (GMT) |
commit | 5a7223450d0ebd4eaa47f263005c6d1c2e142a76 (patch) | |
tree | 9970c8b78e0d5178fbf44bab0317212b2a8c7bdd /src/corelib/kernel | |
parent | 77e5ced3e6b4c1c5ef05684de736bf4939dbe115 (diff) | |
parent | d7d0aaf8bea4e6a5c4c0500a46417d7c788f489a (diff) | |
download | Qt-5a7223450d0ebd4eaa47f263005c6d1c2e142a76.zip Qt-5a7223450d0ebd4eaa47f263005c6d1c2e142a76.tar.gz Qt-5a7223450d0ebd4eaa47f263005c6d1c2e142a76.tar.bz2 |
Merge branch 'qt-4.7-from-4.6' of scm.dev.nokia.troll.no:qt/qt-integration into 4.7-integration
* 'qt-4.7-from-4.6' of scm.dev.nokia.troll.no:qt/qt-integration: (22 commits)
Fix compilation of qegl.cpp after the last merge
Fix a race condition with QtDBus blocking for replies.
QtDBus: Debug message update
Removed DEPLOYMENT from demos/spectrum/spectrum.pro
Install source for spectrum demo
Fixed path for copying launcher script for spectrum demo
My 4.6.3 changes.
Updated WebKit from /home/shausman/src/webkit/trunk to qtwebkit/qtwebkit-4.6 ( ecee9d7244ce4f7e7acf723bcef535532780db5f )
Fixed an assert in QMenu
Backport multitouch bug fixes to 4.6
tst_bic: Add the Qt 4.5 and 4.6 baselines for x86-64
Call eglTerminate() when the last QEglContext is destroyed to free mem.
Removed double EINTR loop from nativeWrite and nativeRead.
Fixed qsslkey test deployment for Symbian and fixed compiler warnings.
Fixing the race condition in event dispatcher implementation on
changes-4.6.3 updated
Fixing the compile issue.
Fixing the compile issue.
Typo.
Removed nearest test from qaudiodeviceinfo unit test.
...
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_symbian.cpp | 46 | ||||
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_symbian_p.h | 20 |
2 files changed, 56 insertions, 10 deletions
diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp index 33775d2..1cb8455 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian.cpp +++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp @@ -100,25 +100,40 @@ static inline int qt_socket_select(int nfds, fd_set *readfds, fd_set *writefds, class QSelectMutexGrabber { public: - QSelectMutexGrabber(int fd, QMutex *mutex) - : m_mutex(mutex) + QSelectMutexGrabber(int fd, QMutex *threadMutex, QMutex *selectCallMutex) + : m_threadMutex(threadMutex), m_selectCallMutex(selectCallMutex), bHasThreadLock(false) { - if (m_mutex->tryLock()) + // see if selectThread is waiting m_waitCond + // if yes ... dont write to pipe + if (m_threadMutex->tryLock()) { + bHasThreadLock = true; return; + } + + // still check that SelectThread + // is in select call + if (m_selectCallMutex->tryLock()) { + m_selectCallMutex->unlock(); + return; + } char dummy = 0; qt_pipe_write(fd, &dummy, 1); - m_mutex->lock(); + m_threadMutex->lock(); + bHasThreadLock = true; } ~QSelectMutexGrabber() { - m_mutex->unlock(); + if(bHasThreadLock) + m_threadMutex->unlock(); } private: - QMutex *m_mutex; + QMutex *m_threadMutex; + QMutex *m_selectCallMutex; + bool bHasThreadLock; }; /* @@ -400,7 +415,12 @@ void QSelectThread::run() int ret; int savedSelectErrno; - ret = qt_socket_select(maxfd, &readfds, &writefds, &exceptionfds, 0); + { + // 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); + } savedSelectErrno = errno; char buffer; @@ -495,7 +515,9 @@ void QSelectThread::requestSocketEvents ( QSocketNotifier *notifier, TRequestSta start(); } - QSelectMutexGrabber lock(m_pipeEnds[1], &m_mutex); + QMutexLocker locker(&m_grabberMutex); + + QSelectMutexGrabber lock(m_pipeEnds[1], &m_mutex, &m_selectCallMutex); Q_ASSERT(!m_AOStatuses.contains(notifier)); @@ -506,7 +528,9 @@ void QSelectThread::requestSocketEvents ( QSocketNotifier *notifier, TRequestSta void QSelectThread::cancelSocketEvents ( QSocketNotifier *notifier ) { - QSelectMutexGrabber lock(m_pipeEnds[1], &m_mutex); + QMutexLocker locker(&m_grabberMutex); + + QSelectMutexGrabber lock(m_pipeEnds[1], &m_mutex, &m_selectCallMutex); m_AOStatuses.remove(notifier); @@ -515,7 +539,9 @@ void QSelectThread::cancelSocketEvents ( QSocketNotifier *notifier ) void QSelectThread::restart() { - QSelectMutexGrabber lock(m_pipeEnds[1], &m_mutex); + QMutexLocker locker(&m_grabberMutex); + + QSelectMutexGrabber lock(m_pipeEnds[1], &m_mutex, &m_selectCallMutex); m_waitCond.wakeAll(); } diff --git a/src/corelib/kernel/qeventdispatcher_symbian_p.h b/src/corelib/kernel/qeventdispatcher_symbian_p.h index bc42753..211ded4 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian_p.h +++ b/src/corelib/kernel/qeventdispatcher_symbian_p.h @@ -211,6 +211,26 @@ 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; }; class Q_CORE_EXPORT CQtActiveScheduler : public CActiveScheduler |