[mythtv] Advice on inter-thread communication and QT

Paul Volkaerts paul.volkaerts at lineone.net
Mon Oct 4 19:34:21 UTC 2004


Perfect thanks.  Knew it would exist but did not look under QApp.

> -----Original Message-----
> From: mythtv-dev-bounces at mythtv.org
> [mailto:mythtv-dev-bounces at mythtv.org]On Behalf Of Isaac Richards
> Sent: 03 October 2004 23:28
> To: Development of mythtv
> Subject: Re: [mythtv] Advice on inter-thread communication and QT
>
>
> On Sunday 03 October 2004 05:26 pm, Paul Volkaerts wrote:
> > Hi;
> >
> > I am in the process of reworking the webcam code in MythPhone to make it
> > run as a separate thread instead of in the GUI thread since it
> can block if
> > there are no frames available.
> >
> > So I have a thread which fills buffers with frames from the webcam
> > asynchronously say every 100ms. Is there a decent mechanism for
> this thread
> > to cause the GUI thread to wake up and process an event?
> >
> > Currently I have a timer running every 100ms in the GUI thread
> which polls
> > to see if there are webcam frames ready; but I really hate that kind of
> > approach. Ideally I'd like the equivelant of "emit" but one
> that causes the
> > callback to be called within the GUI thread instead of the
> calling thread
> > (which I don't believe is the case, right?).
>
> Check out the lirc code in libmyth/lirc* and mythdialogs.cpp - it
> does just
> what you want with a custom event and QApplication::postEvent().
> qapp::postEvent() is threadsafe, and just adds the event to the
> event queue,
> which'll then automatically wake up the gui thread and process the event.
>
> Isaac
> _______________________________________________
> mythtv-dev mailing list
> mythtv-dev at mythtv.org
> http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev
>




More information about the mythtv-dev mailing list