Re: [Interest] post event between threads

2012-04-03 Thread Lincoln Ramsay
On 04/03/2012 07:29 PM, ext Riccardo Roasio wrote: > And so what i can do? Read those docs. In essence, you want something like this: QThread *thread = new QThread; MyObject *object = new MyObject; object->moveToThread(thread); thread->start(); connect(something, SIGNAL(blah()), object, SLOT(foo

Re: [Interest] post event between threads

2012-04-03 Thread André Somers
Op 3-4-2012 11:29, Riccardo Roasio schreef: > And so what i can do? > Or i have to read all the documentation Yes, reading the documentation will help you gain the needed understanding. Threading is a complex topic with many pitfalls. You've been given the list of things to read to understand

Re: [Interest] post event between threads

2012-04-03 Thread Thiago Macieira
On terça-feira, 3 de abril de 2012 11.29.22, Riccardo Roasio wrote: > And so what i can do? > Or i have to read all the documentation Add it to another class. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center Intel Sweden AB -

Re: [Interest] post event between threads

2012-04-03 Thread Riccardo Roasio
And so what i can do? Or i have to read all the documentation Il 03 aprile 2012 11:23, Giuseppe D'Angelo ha scritto: > Do NOT add slots to QThread subclasses. You're doing it wrong. > > Please read ALL of the following docs, wiki articles, blog posts: > > http://qt-project.org/doc/qt-4.8/thre

Re: [Interest] post event between threads

2012-04-03 Thread Giuseppe D'Angelo
Do NOT add slots to QThread subclasses. You're doing it wrong. Please read ALL of the following docs, wiki articles, blog posts: http://qt-project.org/doc/qt-4.8/thread-basics.html http://labs.qt.nokia.com/2010/06/17/youre-doing-it-wrong/ http://qt-project.org/wiki/Threads_Events_QObjects http://

Re: [Interest] post event between threads

2012-04-03 Thread Riccardo Roasio
Ok, here serial rx threaad emit the signal: emit MessageReceivedSignal(); here the main thread catch the signal: connect(rxRoutine, SIGNAL(MessageReceivedSignal()),this, SLOT(TestSlot()),Qt::QueuedConnection); here is the constructor of scriptrunner that should catch the signal but it doesn't

Re: [Interest] post event between threads

2012-04-03 Thread Samuel Gaist
If you show us the code you use to setup the connections, we might be able to offer better help. Samuel On 3 avr. 2012, at 11:09, Riccardo Roasio wrote: > I'm trying using signal/slots with Qt::QueuedConnection. > Now the problem is this one..i have > > - gui thread (main) > > - serial rx thr

Re: [Interest] post event between threads

2012-04-03 Thread Riccardo Roasio
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 s

Re: [Interest] post event between threads

2012-04-03 Thread Riccardo Roasio
Ok, i will try! thanks everybody Il 03 aprile 2012 09:19, Lincoln Ramsay 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 an

Re: [Interest] post event between threads

2012-04-03 Thread Lincoln Ramsay
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::QueuedConnect

Re: [Interest] post event between threads

2012-04-03 Thread Ильгиз Магазов
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 : > I cannot use signal/

Re: [Interest] post event between threads

2012-04-03 Thread Riccardo Roasio
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 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 thre

Re: [Interest] post event between threads

2012-04-02 Thread Thiago Macieira
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 becaus

Re: [Interest] post event between threads

2012-04-02 Thread Andreas Pakulat
On 02.04.12 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

Re: [Interest] post event between threads

2012-04-02 Thread Samuel Gaist
Hi, If you just want to signal that something has arrived, why not simply use signals and slots ? They work across threads. Hope this helps Samuel On 2 avr. 2012, at 18:05, Riccardo Roasio wrote: > Hi, > > how can i post an event from a thread to another? > > my application have a thread tha

[Interest] post event between threads

2012-04-02 Thread Riccardo Roasio
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? Thanks,