diff options
author | Markus Goetz <Markus.Goetz@nokia.com> | 2010-02-03 09:34:46 (GMT) |
---|---|---|
committer | Markus Goetz <Markus.Goetz@nokia.com> | 2010-02-03 12:22:24 (GMT) |
commit | 7cfece145418864b415a91d5b872e65660eb3090 (patch) | |
tree | 0852929919317f85a9951f8f48c6d0f62bced928 /src/network/socket | |
parent | 48d040b3536dbce06f54c90da489a5308bee3870 (diff) | |
download | Qt-7cfece145418864b415a91d5b872e65660eb3090.zip Qt-7cfece145418864b415a91d5b872e65660eb3090.tar.gz Qt-7cfece145418864b415a91d5b872e65660eb3090.tar.bz2 |
QTcpServer: Clarify thread affinity of incoming QTcpSocket
We had some bugreports and support requests related to
misunderstandings about this.
Reviewed-by: Peter Hartmann
Reviewed-by: David Boddie
Diffstat (limited to 'src/network/socket')
-rw-r--r-- | src/network/socket/qtcpserver.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/network/socket/qtcpserver.cpp b/src/network/socket/qtcpserver.cpp index 47a998c..404eee7 100644 --- a/src/network/socket/qtcpserver.cpp +++ b/src/network/socket/qtcpserver.cpp @@ -513,6 +513,10 @@ bool QTcpServer::hasPendingConnections() const 0 is returned if this function is called when there are no pending connections. + \note The returned QTcpSocket object cannot be used from another + thread. If you want to use an incoming connection from another thread, + you need to override incomingConnection(). + \sa hasPendingConnections() */ QTcpSocket *QTcpServer::nextPendingConnection() @@ -543,6 +547,11 @@ QTcpSocket *QTcpServer::nextPendingConnection() may not be usable with native socket functions, and should only be used with QTcpSocket::setSocketDescriptor(). + \note If you want to handle an incoming connection as a new QTcpSocket + object in another thread you have to pass the socketDescriptor + to the other thread and create the QTcpSocket object there and + use its setSocketDescriptor() method. + \sa newConnection(), nextPendingConnection() */ void QTcpServer::incomingConnection(int socketDescriptor) |