[Interest] post event between threads

Riccardo Roasio riccardo.roasio at gmail.com
Tue Apr 3 11:09:47 CEST 2012


I'm trying using signal/slots with Qt::QueuedConnection.
Now the problem is this one..i have

- gui thread (main)

- serial rx thread

- scriptmanager thread
        |
        |----- script runner 1 thread (started from scriptsmanager)
        |
        |----- script runner 2 thread (started from scriptsmanager)
        |
        |----- script runner N thread (started from scriptsmanager)

now the event is emitted from serial rx thread

the main thread is able to catch the signal
the scriptmanager is able to catch the signal
the scriptrunner is NOT able to catch the signal

the only difference is that the sciptrunner has no parent (in the
construtor the parent is NULL)

Riccardo




Il 03 aprile 2012 09:29, Riccardo Roasio <riccardo.roasio at gmail.com> ha scritto:
> Ok,
>
> i will try!
>
> thanks everybody
>
> Il 03 aprile 2012 09:19, Lincoln Ramsay <lincoln.ramsay at nokia.com> ha scritto:
>> On 04/03/2012 05:07 PM, ext Riccardo Roasio wrote:
>>> I cannot use signal/slot because is blocking and i need to continue
>>> reading from serial port while message is processing...
>>
>> If you emit a signal and the receiver lives on the current thread and
>> the connect() call did not use Qt::QueuedConnection, then it is
>> "blocking". If you use Qt::DirectConnection or
>> Qt::BlockingQueuedConnection then it is always "blocking".
>>
>> But if the receiver lives on another thread or if you specified
>> Qt::QueuedConnection then the signal puts an object on the event loop
>> and returns immediately.
>>
>> --
>> Lincoln Ramsay - Senior Software Engineer
>> Qt Development Frameworks, Nokia - http://qt.nokia.com/
>> _______________________________________________
>> Interest mailing list
>> Interest at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/interest



More information about the Interest mailing list