[Interest] post event between threads

Ильгиз Магазов ilgiz at mail.ru
Tue Apr 3 09:18:31 CEST 2012


Hi, Riccardo

just use Qt::QueuedConnection, by default it is a Qt::AutoConnection

for me it works well, 

http://qt-project.org/doc/qt-4.8/qobject.html#connect
http://qt-project.org/doc/qt-4.8/qt.html#ConnectionType-enum


Tue, 3 Apr 2012 09:07:37 +0200 от Riccardo Roasio <riccardo.roasio at gmail.com>:
> I cannot use signal/slot because is blocking and i need to continue
> reading from serial port while message is processing...
> 
> Il 02 aprile 2012 18:47, Thiago Macieira <thiago.macieira at intel.com> ha scritto:
> > On segunda-feira, 2 de abril de 2012 18.05.17, Riccardo Roasio wrote:
> >> Hi,
> >>
> >> how can i post an event from a thread to another?
> >>
> >> my application have a thread that read from a serial port and another
> >> thread that wait for something received on the serial port.
> >>
> >> I cannot use postEvent because in one thread i don'e have reference to
> >> the other...
> >>
> >> How can i do that?
> >
> > You don't post events to threads. You post events to objects only.
> >
> > The events are delivered in each object's associated thread.
> >
> > So, use:
> >
> >        QCoreApplication::postEvent(myObject, new MyEvent);
> >
> > --
> > Thiago Macieira - thiago.macieira (AT) intel.com
> >  Software Architect - Intel Open Source Technology Center
> >     Intel Sweden AB - Registration Number: 556189-6027
> >     Knarrarnäsgatan 15, 164 40 Kista, Stockholm, Sweden
> >
> > _______________________________________________
> > Interest mailing list
> > Interest at qt-project.org
> > http://lists.qt-project.org/mailman/listinfo/interest
> >
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
> 


More information about the Interest mailing list