Changeset 769 for trunk/src/corelib/kernel/qeventdispatcher_symbian.cpp
- Timestamp:
- Aug 2, 2010, 9:27:30 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.6.3 (added) merged: 768 /branches/vendor/nokia/qt/current merged: 767 /branches/vendor/nokia/qt/4.6.2 removed
- Property svn:mergeinfo changed
-
trunk/src/corelib/kernel/qeventdispatcher_symbian.cpp
r651 r769 44 44 #include <qcoreapplication.h> 45 45 #include <private/qcoreapplication_p.h> 46 #include <qdatetime.h>47 46 48 47 #include <unistd.h> 49 48 #include <errno.h> 50 49 50 51 51 52 QT_BEGIN_NAMESPACE 53 54 55 56 57 58 59 52 60 53 61 #define WAKE_UP_PRIORITY CActive::EPriorityStandard … … 93 101 { 94 102 public: 95 QSelectMutexGrabber(int fd, QMutex * mutex)96 : m_ mutex(mutex)103 QSelectMutexGrabber(int fd, QMutex *utex) 104 : m_) 97 105 { 98 if (m_mutex->tryLock()) 106 // see if selectThread is waiting m_waitCond 107 // if yes ... dont write to pipe 108 if (m_threadMutex->tryLock()) { 109 bHasThreadLock = true; 99 110 return; 111 112 113 114 115 116 117 118 100 119 101 120 char dummy = 0; 102 121 qt_pipe_write(fd, &dummy, 1); 103 122 104 m_mutex->lock(); 123 m_threadMutex->lock(); 124 bHasThreadLock = true; 105 125 } 106 126 107 127 ~QSelectMutexGrabber() 108 128 { 109 m_mutex->unlock(); 129 if(bHasThreadLock) 130 m_threadMutex->unlock(); 110 131 } 111 132 112 133 private: 113 QMutex *m_mutex; 134 QMutex *m_threadMutex; 135 QMutex *m_selectCallMutex; 136 bool bHasThreadLock; 114 137 }; 115 138 … … 393 416 int ret; 394 417 int savedSelectErrno; 395 ret = qt_socket_select(maxfd, &readfds, &writefds, &exceptionfds, 0); 418 { 419 // helps fighting the race condition between 420 // selctthread and new socket requests (cancel, restart ...) 421 QMutexLocker locker(&m_selectCallMutex); 422 ret = qt_socket_select(maxfd, &readfds, &writefds, &exceptionfds, 0); 423 } 396 424 savedSelectErrno = errno; 397 425 … … 457 485 458 486 // traversed all, so update 487 459 488 updateActivatedNotifiers(QSocketNotifier::Read, &readfds); 460 489 updateActivatedNotifiers(QSocketNotifier::Write, &writefds); 461 updateActivatedNotifiers(QSocketNotifier::Exception, &exceptionfds);462 490 463 491 break; … … 469 497 } 470 498 } else { 499 471 500 updateActivatedNotifiers(QSocketNotifier::Read, &readfds); 472 501 updateActivatedNotifiers(QSocketNotifier::Write, &writefds); 473 updateActivatedNotifiers(QSocketNotifier::Exception, &exceptionfds);474 502 } 475 503 … … 488 516 } 489 517 490 QSelectMutexGrabber lock(m_pipeEnds[1], &m_mutex); 518 QMutexLocker locker(&m_grabberMutex); 519 520 QSelectMutexGrabber lock(m_pipeEnds[1], &m_mutex, &m_selectCallMutex); 491 521 492 522 Q_ASSERT(!m_AOStatuses.contains(notifier)); …