diff options
author | Pawel Polanski <pawel.3.polanski@nokia.com> | 2011-05-24 12:48:43 +0200 |
---|---|---|
committer | Paweł Polański <jaggernod@gmail.com> | 2011-05-24 16:18:42 +0200 |
commit | 7f9d75c2bb91fe732cc674e34418a4a06c23a6e3 (patch) | |
tree | 8f76c3cf464522e3cada840dcdf968126f5b2088 /src/shared | |
parent | 9d5a094cdfabc13dcd8d7a121104fa03ddb74e99 (diff) | |
download | qt-creator-7f9d75c2bb91fe732cc674e34418a4a06c23a6e3.tar.gz |
Turn off notifier when reading and setting up port
Change-Id: I6f2de72d7a85626d7436f225bbbac43d9dd9816d
Reviewed-on: http://codereview.qt.nokia.com/81
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Paweł Polański <jaggernod@gmail.com>
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/symbianutils/virtualserialdevice_posix.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/shared/symbianutils/virtualserialdevice_posix.cpp b/src/shared/symbianutils/virtualserialdevice_posix.cpp index 7328353320..e855d41c3f 100644 --- a/src/shared/symbianutils/virtualserialdevice_posix.cpp +++ b/src/shared/symbianutils/virtualserialdevice_posix.cpp @@ -136,7 +136,10 @@ qint64 VirtualSerialDevice::bytesAvailable() const if (!isOpen()) return 0; int avail = 0; - if (ioctl(d->portHandle, FIONREAD, &avail) == -1) { + d->readNotifier->setEnabled(false); + int res = ioctl(d->portHandle, FIONREAD, &avail); + d->readNotifier->setEnabled(true); + if (res == -1) { return 0; } return (qint64)avail + QIODevice::bytesAvailable(); @@ -145,7 +148,9 @@ qint64 VirtualSerialDevice::bytesAvailable() const qint64 VirtualSerialDevice::readData(char *data, qint64 maxSize) { QMutexLocker locker(&lock); + d->readNotifier->setEnabled(false); int result = ::read(d->portHandle, data, maxSize); + d->readNotifier->setEnabled(true); if (result == -1 && errno == EAGAIN) result = 0; // To Qt, 0 here means nothing ready right now, and -1 is reserved for permanent errors return result; |