[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: Multithreaded QLocalSocket
From:       Kevin Krammer <kevin.krammer () gmx ! at>
Date:       2008-06-29 12:19:21
Message-ID: 200806291419.21960.kevin.krammer () gmx ! at
[Download RAW message or body]


On Sunday 29 June 2008, Sebastian Trüg wrote:
> Apparently on Unix QLocalSocket uses QTcpSocket internally. This results in
> a big problem when I want to use it in a multithreaded environment as I
> cannot move the internal QTcpSocket to the new thread. Does anyone have an
> idea on how to solve this issue? On how to use QLocalSocket in
> multithreaded systems?

On the server or the client side?

On the client side you could use one QLocalSocket per thread.

On the server side you can use the incomingConnection(quintptr) template 
method of QLocalServer and create the actual QLocalSocket in the target 
thread's context. We do this in Akonadi, see 
kdesupport/akonadi/server/src/akonadi.cpp and 
kdesupport/akonadi/server/src/akonadiconnection.cpp

Cheers,
Kevin
-- 
Kevin Krammer, KDE developer, xdg-utils developer
KDE user support, developer mentoring

["signature.asc" (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic